cookier 쓰기

HttpCookie cookie = HttpContext.Current.Request.Cookies[settings.cookieName];
if (cookie == null)
    cookie = new HttpCookie(settings.cookieName, Guid.NewGuid().ToString());
    cookie.Expires = DateTime.Today.AddYears(1);

In ASP.NET terms, a page receives a CookieCollection as a property of an HttpRequest object (usually Request.Cookies) and returns a CookieCollection of updates as a property of an HttpResponse object (usually Response.Cookies). from On The Care and Handling of Cookies

Set cookier

HttpCookie cookie = new HttpCookie(Settings.CookieName, encryptedTicket);
cookie.Expires = expiryDate;

public static void RemoveCookie(Page page)
//Remove cookie if present
HttpCookie cookie = page.Request.Cookies[Settings.CookieName];
if (cookie != null)
HttpCookie expiredCookie = new HttpCookie(Settings.CookieName, "");
expiredCookie.Expires = DateTime.Today.AddYears(-1);


Andrew Chaa

another day, another PR