This article is a mirror article of machine translation, please click here to jump to the original article.

View: 16257|Reply: 4

[WinForm] How does geckoWebBrowser access a web page with cookies?

[Copy link]
Posted on 9/26/2018 3:25:28 PM | | |
I want to log in to an address and there are cookies now, but I don't know how to access this address with cookies
Ask for guidance@小渣渣




Previous:js compares the difference between two arrays
Next:C# is the easiest way to write logs
Posted on 9/26/2018 3:57:30 PM |
About cookie operation: You can only use CookieManager to add and delete, and get cookies with the browser. Document.Cookie (modifying this directly is invalid)
CookieManager.Add(Host, Path, Name, Value, IsSecure, IsSession, IsHttpOnly, Expiry);
 Landlord| Posted on 9/26/2018 5:24:26 PM |
Xiao Zhazha Posted on 2018-9-26 15:57
About cookie operation: You can only use CookieManager to add and delete, and get cookies with the browser. Document.Cookie (directly edit ...

You actually replied to my post ,,, happy
In other words, CookieManager.Add can only be increased
I don't know where the CookieManager save path is
Also, I don't know how to bind geckoWebBrowser
Enables him to visit a web page with cookies
Thank you in advance
 Landlord| Posted on 9/26/2018 5:27:49 PM |
This post was last edited by wanglke on 2018-9-26 17:37

There is such a code on bitbucket
  protected override void OnContentRendered(EventArgs e)
  {
   base. OnContentRendered(e);

   var authorizedCookies = JsonConvert.DeserializeObject<List<Cookie>>(response. Cookies);

   foreach (var cookie in authorizedCookies)
   {
    CookieManager.Add(url, cookie. Path, cookie. Name, cookie. Value, cookie. Secure, cookie. HttpOnly, true, 60000);
   }

   GeckoWeb.Navigate(url);
  }

https://bitbucket.org/geckofx/geckofx-29.0/issues/49/geckofx-set-authorized-cookie
Although know
The correct way to write it is
foreach (var cookie in cookies)
    {
     CookieManager.Add("www.partslink24.com", cookie. Path, cookie. Name, cookie. Value, false, true, false, (long)DateTimeToUnixTime(DateTime.Now.AddDays(10)));
    }
But I still don't know how to set the path of CookesThank you~~
Posted on 9/26/2018 8:33:43 PM |
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com