Updated Cookie not working on Response.Redirect

I am updating the cookie as follows

if (Request.Cookies["SSOPortalUser"] == null)
                {
                    HttpCookie myCookieSSOPortalUser = new HttpCookie("SSOPortalUser");
                    // Set the cookie value.
                    myCookieSSOPortalUser.Value = currentUser.UserLogin.ToString();

                    // Add the cookie.
                    Response.Cookies.Add(myCookieSSOPortalUser);
                }
                else
                {
                    Request.Cookies["SSOPortalUser"].Value = currentUser.UserLogin.ToString();
                }

But after redirecting to another page, the browser does not update

Response.Redirect(AppSettings.Instance.AppRoot + "OperationSelection.aspx");

and on the OperationSelection page. I am trying to access a cookie, it shows the previous value.

lbluser.Text = Request.Cookies["SSOPortalUser"].Value
+4
source share
1 answer

, , , cookie ( else) - cookie . , cookie cookie ( ). cookie cookie ( , cookie ).

+1

Source: https://habr.com/ru/post/1693394/


All Articles