title: cookie isn't updated until page refresh... how to avoid that?
body: <p>I have some asp.net pages that read and write cookie values.  During the life cycle of a page it may update the cookie value and then need to read it again further in the code.  What I've found is that it's not getting the latest value of the cookie until a page refresh.  Is there a way around this? Here's the code I'm using to set and get the values.</p>
  
  <pre><code>public static string GetValue(SessionKey sessionKey)
          {
              HttpCookie cookie = HttpContext.Current.Request.Cookies[cookiePrefix];
              if (cookie == null)
                  return string.Empty;
  
              return cookie[sessionKey.SessionKeyName] ?? string.Empty;
          }
  
          public static void SetValue(SessionKey sessionKey, string sessionValue)
          {
              HttpCookie cookie = HttpContext.Current.Request.Cookies[cookiePrefix];
              if (cookie == null)
                  cookie = new HttpCookie(cookiePrefix);
  
              cookie.Values[sessionKey.SessionKeyName] = sessionValue;
              cookie.Expires = DateTime.Now.AddHours(1);
              HttpContext.Current.Response.Cookies.Set(cookie);
          }
  </code></pre>