Cookie question

  • Thread starter Thread starter adouglas
  • Start date Start date
A

adouglas

Guest
Im working on an ASP.NET application. My site stores a couple of values in a couple of cookies, sets their expiry date to be Date.Now.Addhours(2), then redirects to another site. This other site then redirects back to my site. I then go to read the values from the cookies I wrote before redirecting, but they dont seem to be there. But if I then close the browser, open it again and go to my site, my original cookies are there again. So theyre being stored on the client machine alright, but for some reason they cant be seen when I return from this other site.

Any ideas why this is happening and suggestions on how I can see my cookies when I get back from the other site without having to restart the browser?

If it makes a difference (although I dont see why it would), the other site Im redirecting to is standard ASP, not ASP.NET.
 
Make sure the site is actually redirecting back to a page on your server, and not a cached version. I see no other reason, short of client-side cookie blocking, for this to be happening.
 
Is there any way for me to tell if its directing to a page on the server and not a cached page? Ive set Response.Expires=-1500 which is what I used to do with the old ASP to make sure it would load a fresh version of the page every time. Is there something else I need to do in .NET to make sure it gets a fresh copy of the page each time?
 
Try to add this in your form_load sub
Dont cache the page
Response.CacheControl = "no-cache"
Response.AddHeader("Pragma", "no-cach")
Response.Expires = -1
 
Back
Top