It is happening - but not all the time. If I step through the code, it works
as expected. It works fine 80% of the time, but there are other times when
it pulls the prior cookie and reloads the wrong row.
private void NewButon_Click(...)
{
HttpCookie Cookie = new HttpCookie("CaseId", 0);
HttpContext Current.Response.Cookies.Add(Cookie);
LoadData();
}
private void LoadData()
{
HttpCookie Cookie = HttpContext.Current.Request.Cookies["CaseId"];
///Sometimes Cookie is equal to the prior cookie set !!!!
}
Actually, I was setting the cookies in a separate class using the
HTTPContext. When I tried pasting it directly into my code, I was using
Response.Cookies, but both seemed not to work well.
"Curt_C [MVP]" wrote:
Denise wrote: I have an application that sets a cookie through a class. I set it in a push
button event on a postback. When the page reloads, a user control checks the
value of that cookie to display name information. The problem is - the
cookie is not being set fast enough for the user control to find it. Can you
offer any solution?
Thanks,
Denise
Huh? I dont think that's possible. If it's linearly executed code its
not possible. Are you sure there isn't a potential issue elsewhere?
Perhaps cookies aren't allowed, not set properly, not called properly, etc?
--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com