problem with setting cookie expiry date

  • Thread starter Thread starter Milsnips
  • Start date Start date
M

Milsnips

Hi there,

I don't know why its not working for me, here is the code I am using:

Response.Cookies["TestCookie"].Value = "Cookie is set";
Response.Cookies["TestCookie"].Expires = DateTime.Now.AddYears(30);
Response.Redirect("cart.aspx");

then it redirects to the cart page where i read the cook which it can see,
however the date is set to 01/01/0001 00:00:00... but in debug mode when i
checked Response.CookiesResponse.Cookies["TestCookie"].Expires - it shows
todays date + 30 years as it should be.

Any help appreciated!
thanks,
Paul
 
Looks like you might have found a real bug to me. Same result if you use
Server.Transfer, and same if you create a new HttpCookie and populate its
properties then add to the Response.Cookies collection.

Maybe somebody else can add something.
Peter
 
Back
Top