System. Web. httpcookie class, corresponding to the Collection class system. Web. httpcookiecollection class
System. net. Cookie class, corresponding to the Collection class system. net. cookiecollection class
Differences:
System. Web.
HttpCookie and Cookie security, httpcookiecookie
Cookie used by Web Applications
I personally think that the cookie set here is more closely related to the security of the access cookie. The configuration section is as follows:
HttpOnlyCookies:
Recently, I wrote a program and found that there is also a Cookie class under System. Net. By the way, I sorted out the differences between the two cookies:
1. System. Net. Cookie
Indicates the Cookie used by the client. The client application can
Describes the HTTP cookie status management mechanism and cookie details. HTTPCookie status management mechanism, cookieHTTPcookies, also known as cookies, have existed for a long time, but are still not fully understood. The first question is the
C # commonly used public methods, the specific contents are as follows
1. Background Call Weburl
String hosturl = "http://www.a.com?id=123";
HttpWebRequest Myreq = (HttpWebRequest) webrequest.create (hosturl);
Myreq.method =
When it comes to cookies, I think we should all know that it is a save on the client, when the browser requests a URL, the browser will carry the relevant cookies to the server side, so the server can operate cookies, in response, the cookie
Cross level two domain nameWe know that cookies can be accessed across level two domains, which is well understood, such as the Web application you www.test1.com create a cookie, To access the two-level domain name corresponding to the bbs.test1.com,
Write cookie login record for other system usepublic void Writecookie (string user, string password, string ulevel, String utype){Delete the previous user record when Deletecookie ()//increase record
httpcontext.current.response.cookies["UserName"].
Cookies have three properties to note:
. Domain domains
. Path paths
. Expires Expiration Time
Domain properties need to be set for cross-domain operations:
Response.Cookies ("MyCookie"). Domain = "Jb51.net"; (this refers to the generic domain name)
after using the second-level domain name in the blog garden, it is found that even if the user has logged on, the second-level domain name blog page shows that the user has not logged on (as shown in the form of a comment, you must enter a
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.