Re: Setting Cookie.Expires

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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: msdnmg@xxxxxxxxxxxxxx

==================================================
Get notification to my posts through email? Please refer to

http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
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" <jbassking@xxxxxxxxxxxxxxx>
References: <Osj6V78fIHA.2000@xxxxxxxxxxxxxxxxxxxx>
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" <jbassking@xxxxxxxxxxxxxxx> wrote in message
news:Osj6V78fIHA.2000@xxxxxxxxxxxxxxxxxxxxxxx
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





.



Relevant Pages

  • RE: Sync failure for some subscribers using merge replication
    ... subscription can expire if it has not synchronized within 24 hours. ... Microsoft Online Community Support ... nature are best handled working with a dedicated Microsoft Support Engineer ...
    (microsoft.public.sqlserver.replication)
  • Re: Question about cookies.
    ... Hey Roland, Have a look at this article, ... destroyed when the user closes his/her browser. ... destroy the cookie. ... > Sessions do not expire when the client closes the browser. ...
    (microsoft.public.scripting.vbscript)
  • Re: Cookies in non-server pages?
    ... Why do you assume it was my intention to let the cookie ... >> most computers the time behaves more like GMT than UTC)? ... >Because this is but an example for a cookie that will not expire by the end ... So why use a deprecated method when a non-deprecated one will do the ...
    (comp.lang.javascript)
  • Re: Setting Cookie.Expires
    ... Microsoft MSDN Online Support Lead ... As for the Cookie expire time, it does have been set on the cookie (you ...
    (microsoft.public.dotnet.framework.aspnet)
  • "Page has expired" - again
    ... The web site has anonymous access and the only cookie ... >This sounds like a scripting issue on the site. ... they are set to expire. ... >>major like converting POST to GET etc. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)