javascript - How to avoid duplicate cookie for my asp.net application -
I am using a client side cookie to keep a database (string), when the user reopens Browser is helping to use the same data. My concern is that many cookies are created with the same name on the same URL (the user only feels that) Ex URL: -
But the user URL typing-ascentive, typing in the form of beer in the past.
There is no difference to user interfaces, but various cookies were created internally. Can anyone help me avoid such a duplicate?
Thanks Pavan
Cookie names such as Chrome and Firefox for some browsers -Sensitive.
To avoid this, you should use a helpful method to create a cookie, so that the name of the cookie will be relevant to your site. / P>
For example,
public class cookie helper {public static zero set cookie (string cookie name, string cookie value, int day) {cookieName = cookieName.ToLower (); Var Cookies = New HTTP Cookies (Cookies) {Value = Cookie Value, Exposures = Datetime. Now.AddDays (Days)}; HttpContext.Current.Response.Cookies.Add (cookie); } Public Static String GetCookie (String Cookie Name) {try {cookieName = cookieName.ToLower (); If (HttpContext.Current.Request.Cookies [cookieName] == faucet) return string. Empty; Return HttpContext.Current.Request.Cookies [cookieName]. value; } Hold {return string}. Empty; }}}
Comments
Post a Comment