In fact, it is quite easy to operate a web page in WebBrowser, which can easily implement custom Website access habits. WebBrowser, after all, is the encapsulation of the native control of MS. When we use the WebBrowser under C #, especially in this way, although it is more convenient for you to remove it, but his convenience is at the cost of flexibility.
One day I want to use WebBrowser to obtain the COOKIE of a website. When I call Document. Cookie, I find that the COOKIE cannot be fully obtained and cannot be completely understood. This simple function will make WebBrowser look funny. After packet capture analysis, it is found that the website adds httponly to the key cookies written to the user end.
HttpOnly is actually a function to improve the security of WEB site applications, but it is often ignored. For example, this sub-configuration is provided in the preparation file of ASP. NET 2.0 web. config.
Reprinted please indicate the source: http://www.mobans.cn/net/1524.html
1 2 // the. NET code is as follows:
3 HttpCookie myCookie = new HttpCookie ("myCookie ");
4 myCookie. HttpOnly = true;
5 Response. AppendCookie (myCookie );
This is just a small setting. WebBrowser has nothing to do with him, but has checked a lot of information. To achieve this function, you must read and write the original network stream, this method is too difficult for many programmers to implement. The following is a simple implementation method.
1 public string Cookie ()
2 {
3 if (this. Url = null)
4 return null;
5 strin