Hi Joe,
As for the Cookie expire time, it does have been set on the cookie (you add
into the Response.Cookies collection). The problem that you didn't see the
expire value the next time the page submit is because the client browser or
the request http message doesn't include the expire date value. I 've
performed test by adding cookie with expire date assigned and post the page
again. I use some utility to trace the http request/response and found that
the response http message will include expire date(you asigned) for cookie,
however, thet request message will only include name/value pair for
cookies.
I think this is a fixed behavior of webbrowser since it will maintain the
expire/validation of cookies. If a cookie has expired, the browser will no
longer send it (and remove it at client).
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we
can improve the support we provide to you. Please feel free to let my
manager know what you think of
the level of service provided. You can send feedback directly to my manager
at: (e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#noti f
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response
from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take
approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution.
The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump
analysis issues. Issues of this nature are best handled working with a
dedicated Microsoft Support
Engineer by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "Joe" <
[email protected]>
References: <
[email protected]>
Subject: Re: Setting Cookie.Expires
Date: Thu, 6 Mar 2008 16:15:16 -0500
Sorry I made a mistake in the posting. When I check
this.Context.Request.Cookies["mycookie"].Expires it is the default value.
Joe said:
I'm trying to set the Expires property of a cookie in a control by doing
the following:
this.Context.Response.Cookies["mycookie"].Expires =
DateTime.Today.AddDays(1);
But when I refresh the page and check the same
this.Context.Response.Cookies["mycookie"].Expires it has the default date
1/1/0001.
Any idea what I'm doing wrong?
Thanks,
Joe