problem with setting cookie expiry 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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Test cookie 1
Cookie Basics 1
cookie trouble 3
Can i have a cookie 3
Simple question about cookies 1
Cookie problem 8
cookie expiry date 01/01/0001 3
Setting the Cookie Expires 1

Top