Note that there are some explanatory texts on larger screens.

plurals
  1. POcookie problems in asp.net. Values reverting after response.redirect
    primarykey
    data
    text
    <p>I have spent sooooo many hours on this it is insane. </p> <p>I have a page base class which contains a "setcookie" function and this is basically this:</p> <pre><code> Dim context As HttpContext = System.Web.HttpContext.Current If context.Request.Cookies(cookieName) Is Nothing Then Dim cookie As HttpCookie cookie.Value = cookieValue cookie.Expires = DateTime.Now.AddDays(7) context.Response.Cookies.Add(cookie) Else Dim cookie As HttpCookie = context.Request.Cookies(cookieName) cookie.Expires = DateTime.Now.AddDays(7) cookie.Value = cookieValue End If </code></pre> <p>This function is called by a simple aspx page. As this is in a test environment there is a previous value of "123" in the cookie I'm using. If I use the debug and watch window, I see the value change to "168" successfully.</p> <p>I have a debug break point on a line which is: </p> <pre><code> Response.Redirect("overview.aspx", False) </code></pre> <p>When the break point is active, the values in the watch window are:</p> <pre><code> currProjectID 168 Integer HttpContext.Current.Request.Cookies("currProjectID").Value "168" String </code></pre> <p>(currProjectID is a property in the basepage class that gets/sets the cookie with the function above)</p> <p>Now, the second I step off the breakpoint line above using "F10" the values of the variable change! </p> <pre><code> HttpContext.Current.Request.Cookies("currProjectID").Value "123" String currProjectID 123 Integer </code></pre> <p>This is insane! The code goes nowhere, the debug point is immediately under the "response.redirect" line above and yet the values have immediately changed to what they were before! Nothing has gone near the "setcookie" routine so please please please would someone save my insanity and tell me what is going wrong!?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload