views:

99

answers:

1

I'm adding a header for Set-Cookie manually, in VBScript, so that I can include HttpOnly.

When I make a Set-Cookie header that includes this expires value:

expires=5/13/2010 9:57:35 AM;

Internet Explorer 8 does not set the cookie (FireFox does). This is what expires date formatting look like when set by Response.Cookies("cookieName").Expires:

expires=Tue, 01-Jan-1980 08:00:00 GMT;

How can I format the first date so that it looks like the second date?

Thanks.

A: 

VBScript's FormatDateTime() is pretty limited, so that's not an option in your case. As far as I can see, your only option to format the date as you are asking would be to write a rather long and tedious function to parse out the date, probably with liberal use of the DatePart() function... Personally, I'd just change to Asp.Net rather than bother with it, but likely that's not feasible.

However, this previous question, which asks the question you're not asking but (I think) you should be, may be more helpful to you.

David Stratton