Ever tried to set cookie expiry date using JavaScript?

V

Vince C.

Hi all.

I'm trying to set a cookie expiry date but my script is JS (JavaScript). I've
tried

Response.Cookies("Test").Expires = Date();
Response.Cookies("Test").Expires = Date().toLocaleString();
Response.Cookies("Test").Expires = Date().toString();
Response.Cookies("Test").Expires = Date().toUTCString();

none works. I've seen what bothers IIS is the day name when assigning the expiry
date: "7 février 2004 11:57:57" is ok while "samedi 7 février 2004 11:57:57"
produces an error "Invalid type".

Ok, I could switch to VB Script (which I think I'll do because of the ease of
doing it in that language). But I'd like to know if there are well-known tricks
on using IIS/ASP and cookies expiry date in JavaScript. It seems IIS object
model is unable to recognize (or handle) JavaScript dates...

Might sound a stupid question but I'd like my script to be as platform
independent as possible. Why? I'm running a French version of Windows 2000/IIS5.
I might have to host my web on an English version. Or whatsoever. I wouldn't
like to triturate the date string for it depends on the current locale. If
JavaScript cannot be used without modifying the string I'll switch to VB script.

Thanks for any hint or suggestion.

Vince C.
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top