public string SetAuthCookie(HttpContext httpContext, string authenticationTicket, string cookieName, string key, DateTime Expiration) { var encryptedTicket = DisplayUtils.Encrypt(authenticationTicket, key); var cookie = new HttpCookie(cookieName, encryptedTicket) { HttpOnly = true, Expires = Expiration }; httpContext.Response.Cookies.Add(cookie); return(encryptedTicket); }