using a cookie with System.Net.WebClient - 07-06-2005 , 05:07 PM
i use aan application to download an aspx file, and check ik for some values.
But there had been a change, there is a login script that checks if you have a cookie, if not it show a "username/password" screen (url remains the same)
i know the username password, and if i fill it once my browser never shows it anymore.
But how can i use this cookie to still download te aspx?
this is my current code:
System.Net.WebClient Client = new System.Net.WebClient();
System.IO.Stream strm = Client.OpenRead(@"http://url.to/myfile.aspx");
System.IO.StreamReader sr = new System.IO.StreamReader(strm,System.Text.Encoding.A SCII,false,20480);
x = sr.ReadLine() ;
// check some stuff
while (x !=null);
Now it stream only contains the source of the "login page" and not the source after you've entered the username / pwd.
does anyone know how to combine this with a cookie? (i know which one it is in my cookies directorie)
Thanks for thinking with me.
--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-
Re: using a cookie with System.Net.WebClient - 07-06-2005 , 05:24 PM
Framework group for that.
Anyway, you have to use a CookieContainer object in combination with a
HttpWebRequest -- WebClient isn't sophisticated enough for this use
mailto:news-reply (AT) joergjooss (DOT) de
|Thread Tools||Search this Thread|