Tuesday, January 19, 2016

why cookies are always null after postback

private static string GetCookie(string name)
{
    return HttpContext.Current.Request != null ? HttpContext.Current.Request.Cookies[name].Value : string.Empty;
}
 
private static void SetCookie(string name, string value)
{
    HttpContext.Current.Request.Cookies[name].Value = value;
    HttpContext.Current.Request.Cookies[name].Expires = DateTime.Now.AddDays(100);
}

No comments:

Post a Comment