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

View: 23988|Reply: 0

[Source] C# converts WebBrower's cookie text to a CookieCollection object

[Copy link]
Posted on 2/20/2017 10:38:34 AM | | |

Sometimes for convenience, we use WebBrower to log in, then get cookies, and then use the obtained objects elsewhere. But the cookie fetched from WebBrower is of type string. Not a cookie object. This involves converting the cookie string into a cookie object. For example, convert to a CookieCollection object.

Obtaining cookies from WebBrower is actually very simple, as long as this sentence can be obtained.
String cookie=WebBrower1.Document.Cookie;

This obtains the cookie string.

The next step is to convert the cookie string into an object.

In fact, the cookie string itself consists of fields and values, and is used together; Separation.
So identify each field and value, just add it.

Here's the code.

   
Code usage






Previous:.net/c# Start ie browser with cookies [source code]
Next:js converts 15-digit ID cards into 18-digit ID numbers
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