/ Published in: C#
Expand |
Embed | Plain Text
public class Cookie { public Cookie() { } public void Set(string name, string value, DateTime expires) { cookie.Value = value; cookie.Expires = expires; HttpContext.Current.Response.Cookies.Add(cookie); } public string Get(string name) { HttpCookie cookie = HttpContext.Current.Request.Cookies[name]; if (cookie != null) return cookie.Value; else return String.Empty; } public void Delete(string name) { cookie.Expires = DateTime.Now.AddDays(-1d); HttpContext.Current.Response.Cookies.Add(cookie); } }
You need to login to post a comment.
