Home > Net >  Information about webBrowser for cookies automatically download site files
Information about webBrowser for cookies automatically download site files

Time:10-16

After before use the following code to obtain the cookies, can automatically download website file to the computer, but now changed to HTTPS url from the original HTTP after beginning, download files always suggest not login, can't automatically download, HTTPS encryption unable to get a Cookie, please? Are there any other method? In order to realize the function of the is: manually enter the account password after login web site program files automatically download website,
 
Private void GetCookie ()/login/take cookies
{
MyCookieContainer=new CookieContainer ();
Login//take webBrowser1 cookies information:
//String type of cookies to switch to a Cookie and into the CookieContainer
String cookieStr=webBrowser1. Document. Cookies;
String [] cookstr=cookieStr. Split ('; ');
To remove the cookies//traversal and construct new cookies information
The foreach (string STR in cookstr)
{
String [] cookieNameValue=https://bbs.csdn.net/topics/str.Split ('=');
Cookie ck=new Cookie (cookieNameValue [0]. The Trim (), ToString (), cookieNameValue [1]. The Trim (), ToString ());
Ck. Domain=https://* * *. Com: "8180";//cookies information domain name
MyCookieContainer. Add (ck);
}
}

CodePudding user response:

Based on security considerations, HTTPS adds some limitations, after the test the switch to HTTPS, can use the browser to download?
  •  Tags:  
  • C #
  • Related