I faced such a problem that when I create cookies in Global.asax, it is not immediately added to the page.
The following code is executed in Application_AuthenticateRequest.
FormsAuthenticationTicket newticket = new FormsAuthenticationTicket(2, name, DateTime.Now, DateTime.Now.AddMonths(1), rememberMe, cookieData); HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(newticket)) { Path = FormsAuthentication.FormsCookiePath + "; HttpOnly; noScriptAccess", Secure = FormsAuthentication.RequireSSL }; if (newticket.IsPersistent) authCookie.Expires = newticket.Expiration; HttpContext.Current.Response.Cookies.Add(authCookie); I update the page, during the update should be added cookies. After the update, there is no cookie. It was added, as it were, but not yet displayed. It takes effect only after the next page refresh.
What to do?