[thelist] Cookie Help - Mozilla problem

Ken Schaefer ken.schaefer at gmail.com
Sat Jul 31 00:34:57 CDT 2004


Using Response.Expires in ASP should result in ASP outputting the
correct Expires HTTP header. Only if you manually add the header
yourself using:

Response.AddHeader "Expires", "<value>"

do you need to ensure that your date/time is formatted correctly. If
the date/time format being output by ASP isn't what you need, you'll
need to go down the manual route. That said, Response.Expires expects
a valid date/time. If you want to use string literal, you should use
Response.ExpiresAbsolute or manually add the header using
Response.AddHeader.

Additionally, IIRC, the HTTP spec states that any date/time that isn't
valid, or understood by the client, should be construed as an expired
document.

Cheers
Ken

On Sat, 31 Jul 2004 03:52:47 +0900, Andrew Clover <and-evolt at doxdesk.com> wrote:
> John Spurgin <johns at net-communities.co.uk> wrote:
> 
> > Response.Cookies("cookieName").Expires = "July 31, 2000"
> 
> The expires date in Cookies has a specific date format, which browsers
> tend to be quite picky about. The original date format was defined by
> Netscape to be like:
> 
>   Wdy, DD-Mon-YY HH:MM:SS GMT
> 
> This is of course a stupid format as (a) it has a superfluous weekday,
> (b) the weekday and month are names in a language, (c) it has a
> two-digit-year, (d) it has a timezone in it ARGH, and (e) it's not a
> valid string from which to make a JavaScript Date object nor a
> particulary easy string to generate from a JavaScript Date object.
> 
> These days you can use a four-digit year and all browsers should accept
> it (hopefully few of your readers will be using Netscape 3). But
> fiddling with the rest of the format is not generally advisable (though
> I don't know of a browser than complains if you get the weekday wrong).


More information about the thelist mailing list