Published in: C#
public static void Cookie_Set(string strCookieName, string strCookieValue, DateTime dtExpires) { cookie.Value = strCookieValue; cookie.Expires = dtExpires; HttpContext.Current.Response.Cookies.Add(cookie); } public static string Cookie_Get(string strCookieName) { HttpCookie cookie = HttpContext.Current.Request.Cookies[strCookieName]; if (cookie != null) return cookie.Value; else return ""; } Delete cookie: myCookie.Expires = DateTime.Now.AddDays(-1d); Response.Cookies.Add(myCookie);
You need to login to post a comment.
