You need to use a WebRequest and CookieContainer. That way, on your first login request, the authentication cookie is returned and then sent with any subsequent requests, thus remaining logged in. http://stackoverflow.com/questions/787857/multiple-webrequest-in-same-session[^]
Gavin Roberts
Posts
-
Using C#, how can I log into a website and click Continue -
Accessing HID Devices...hey everyone, I have purchased an Omron M10-IT (HEM-7080IT-E) which has the ability to connect to the device and download data via it's USB connection. Using the software sent with the device, everything's fine, but when trying to read/write anything, it either echo's the sent value or just waits for a response (which it never gets) Has anyone come across any pit falls when developing applications that access the HID Api in windows? I can find and connect to the device, get the capabilities, but can't read/write. :( Cheers Gavin
-
Listview rubberbanding issueWell i've resolved it. By setting the following properties, it no longer causes the undesired effect. FullRowSelect = true; HeaderStyle = NonClickable; HideSelection = false; MultiSelect = false;
-
Listview rubberbanding issueHi all, It seems an application i'm working on has developed a problem. My colleague has created a user control which inherits the ListView control so we can implement an edit in place feature. The edit in place feature simply listens for an event when you click on a rows subitem and if its the cell you want to edit, it will move and resize a textbox over the cell and pull the value. An event (endediting) is fired when the control looses focus or a certain key is pressed. We use this event do what we want with the value typed in. This seems to work fine unless you stick in something that causes the listview to loose focus whilst within this event. I am attempting to parse the value typed in and if its invalid, I am throwing an error (messagebox) to notifiy the user and setting the cancel flag (e.Cancel.) If I use the mouse to click the OK button within the MessageBox, when it disappears an Rubberband appears on my cursor and remains inside the listview. The only way to remove this is to either click the mouse, alt+tab to cause the form to invalidate or press escape. If I use the enter or escape key to clear the MessageBox, the above doesn't happen and the listview regains focus. I'm now at a loss, I have no idea where to turn :(( I have tried invalidating the form, the listview etc, i've tried forcing the focus of all of the controls within the same form and i've even tried sending the escape key to the app using sendkeys. Has anyone got any idea's why? I'd appreciate your input! Regards
-
Back from Francelol even better I live in Birtley. (I said gateshead just incase you lived further out and didn't know of Birtley).
-
Back from FranceWhere abouts in the North East? I'm in Gateshead.
-
Back from FranceLovely place to visit, we've been many times and god knows why but we visit the dry docks every time. Last time we visited the area, we drove up the coast visiting all the WW2 landing sites, many of which are in Normandy. My parents enjoy france alot, and rather then staying in a holiday park, they rent Gité's out and stick to the local stuff. We were in Epernay (champagne region) last time, but unfortunately I ended up with phneumonia (sp) and had to stay in hospital for a week. Luckily, the french health care is better then the UK's NHS, possibly because its private.
-
how to make sure Socket has connected?I am using Socket.Connect to connect. At the moment, I am having to use Socket.Receive to determine whether the connection is valid or not. I was using Socket.Available, but this only seemed to work when I was stepping through each line using Visual Studio. As soon as I removed all breakpoints and allowed it to continue as normal, Socket.Available returned incorrect data, as if it hadn't enough time to populate. Socket.Receive is slow for a invalid Connection, and i'd prefere to speed this up. Thanks Gav
-
how to make sure Socket has connected?Sorry. Basically I use Socket.Available to check if any data is available before continuing which whilst stepping through with a debugger, works fine as soon as I run the code with no breakpoints Socket.Available returns 0. I am currently using Socket.Read to check but that is quite slow. Cheers for the reply. Gav
-
how to make sure Socket has connected?Hi all, I would like to be able to correctly determine whether I have connected to my Host before trying to login. Everything I can think of trying has failed. If I try connecting to 192.168.0.1 110 it says its connected, but has 0 bytes Available. Which is great, and works for valid and invalid addresses whilst debugging, but as soon as I remove all breakpoints it comes back with errors on the valid addresses. I done a quick search, and found using a mixture of Poll and Available which unfortunately doesn't work either. Basically I don't want any code to continue until I have a Connected and Communicating Socket. Any idea's? Regards Gav
-
File Access on Remote Computersnet use G: \\host\path password /user:username http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/net\_use.mspx?mfr=true or In an explorer window, click Tools and Map Network Drive. You can then put in the details there.
-
Sortable CollectionBase ?Hi there, Thanks for the sample code. I've gone to use it this morning and hit another problem. I've created this:
public interface RequestCollectionInterface { ImageList Images { get; set; } int OpenCount { get; } int PendingCount { get; } int ImmediateCount { get; } int HighCount { get; } } public class RequestCollection<T> : List<T>, IEnumerable<T> where T : RequestCollectionInterface { IEnumerator<T> IEnumerable<T>.GetEnumerator() { for (int i = 0; i < this.Count; i++) { yield return this[i]; } } IEnumerator IEnumerable.GetEnumerator() { throw new Exception("The method or operation is not implemented."); } public int OpenCount { get { int ReturnValue = 0; foreach (Request item in this) { if (item.Status == RequestStatus.Open) ReturnValue++; } return ReturnValue; } } public int PendingCount { get { int ReturnValue = 0; foreach (Request item in this) { if (item.Status == RequestStatus.Pending) ReturnValue++; } return ReturnValue; } } public int ImmediateCount { get { int ReturnValue = 0; foreach (Request item in this) { if (item.Priority = RequestPriority.Immediate) ReturnValue++; } return ReturnValue; } } public int HighCount { get { int ReturnValue = 0; foreach (Request item in this) { if (item.Priority = RequestPriority.High) ReturnValue++; } return ReturnValue; } } }
And tried using it like this:private RequestCollection<Request> __GetRequests() { RequestCollection<Request> rc = new RequestCollection<Request>();
-
Sortable CollectionBase ?Hmm, This annoys me about .Net 2.0. I want a collection dedicated to one type, and they bring out generic collections?! Probably why i've not hit that part of .Net 2.0 just yet. I've tried the following http://en.csharp-online.net/Understanding_Generics%E2%80%94Creating_a_Custom_Generic_Collection[^] but received errors. I need to be able to have methods and custom properties for my collection, if there is a way to do this, i'd be greatful if you could let me know. Thanks
-
Sortable CollectionBase ?Hi all, I'm working on an application, and being new to 2.0 I need some help. I have a Custom Collection which inherits CollectionBase and i'm using this as a DataGridView datasource. All is fine, apart from the Sorting does not work anymore (I used to manually add each row.) When I tried to use Sort, it complained that my CollectionBase does not inherit the IBindingList class. I've tried but I never really got far. Does anyone have any examples which will help me?
using System; using System.Collections; using System.Windows.Forms; using System.Text; using System.ComponentModel; namespace HelpDesk { class RequestCollection : CollectionBase { public void Add(Request r) { r.Parent = this; List.Add(r); } public Request this[int index] { get { return (Request)List[index]; } set { List[index] = value; } } private ImageList _Images; public ImageList Images { get { return _Images; } set { _Images = value; } } public int OpenCount { get { int ReturnValue = 0; foreach (Request r in List) { if (r.Status == RequestStatus.Open) ReturnValue++; } return ReturnValue; } } public int PendingCount { get { int ReturnValue = 0; foreach (Request r in List) { if (r.Status == RequestStatus.Pending) ReturnValue++; } return ReturnValue; } } public int ImmediateCount { get { int ReturnValue = 0; foreach (Request r in List) { if (r.Priority == RequestPriority.Immediate) ReturnValue++; } return ReturnValue; } } public int HighCount { get { int ReturnValue = 0; foreach (Request r in List) { if (r.Priority == RequestPriority.High) ReturnValue++; } return ReturnValue; }
-
Three weeksCongrats.. I gave up just after xmas. I'm sick of waking up before my alarm. I have Asthma as well, and I used to go through 2 inhalors a month. I've used 2 in 4 months now, and thats mainly down to allergies (dust etc.) Again congrats.!
-
Disable DataGridView auto selecting 1st rowI've found that ClearSelection will only work if I use the DataSource property.
-
Disable DataGridView auto selecting 1st rowAnd do what may I ask? I am unable to change it and the grid.RowTemplate.Index is read-only.
-
Disable DataGridView auto selecting 1st rowI have tried ClearSelection and I have also set the selection mode to select a full row
-
Disable DataGridView auto selecting 1st row.Net 2.0 with C# 2005. I am using a WinForms DataGridView.
-
Disable DataGridView auto selecting 1st rowthere isn't a selectedIndex property and I haven't hooked any events as of yet.