Hi all.
I'm trying to set a cookie expiry date but my script is JS (JavaScript). I've
tried
Response.Cookie s("Test").Expir es = Date();
Response.Cookie s("Test").Expir es = Date().toLocale String();
Response.Cookie s("Test").Expir es = Date().toString ();
Response.Cookie s("Test").Expir es = Date().toUTCStr ing();
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. 2 19878
Hi Vince,
Based on my experience, we may use JavaScript and Date function to set
cookies on client side, for example: http://www.webreference.com/javascri...25/source.html
On server side, we can convert the date to a string like "mm/dd/yyyy" or
use VB script instead.
Luke
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
I use this little function when making a cookie in javascript. It seems to
work all the time.
function createCookie(na me,value,days) {
if (days) {
var date = new Date();
date.setTime(da te.getTime()+(d ays*24*60*60*10 00));
var expires = "; expires="+date. toGMTString();
}
else expires = "";
document.cookie = name+"="+value+ expires+"; path=/";
}
"Vince C." <no**@hotmail.c om> wrote in message
news:ux******** ******@TK2MSFTN GP10.phx.gbl... Hi all.
I'm trying to set a cookie expiry date but my script is JS (JavaScript).
I've tried
Response.Cookie s("Test").Expir es = Date(); Response.Cookie s("Test").Expir es = Date().toLocale String(); Response.Cookie s("Test").Expir es = Date().toString (); Response.Cookie s("Test").Expir es = Date().toUTCStr ing();
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.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: chrism |
last post by:
Hello,
I have a pop-up window that I would like to appear in front of the
browser home page when a user opens IE. Problem is, I'd like it to
never appear again if the user navigates back to the home page during
their time using the browser. However, if the user closes the
browser, then reopens, the pop-up should appear again. (you may have
guessed that this will be used for public access pc's.) I want to try
as best I can to catch...
|
by: Hardeep Rakhra |
last post by:
Hi i have a snippet of JS that i want to change so that the cookie it
creates lasts only 48 hours. (or any other length of time i decide, but
48hours seems right for now)
Only thing i can't figure out how it specifies the expiry time.
Thanks!
Hardeep
|
by: What-a-Tool |
last post by:
How does the expire date work setting it server side with asp.
I know with javascript setting it client side it will be set to the clients
local time, and therefore expire when the clients local time reaches the set
expire-time.
But if it is an expire time set on my server in California, and the cookie
is put on a computer that is running on London Time, and the expire time is
set at the server as 20 minutes from now, the London computer...
|
by: HorseGeek |
last post by:
I can't find a cookie that my code is writing. The behavior of my
webpages indicates that the cookie IS being written SOMEPLACE.
However, I can't find it.
My client does not want the code going into production unless they can
actually see where the cookie is being written. They are concerned
that the cookie may stay around after they leave the screen and grant
authorization to other users to get to web pages that they are now
allowed...
|
by: Aki |
last post by:
Hi,
I have a problem with writing cookies in IE. The code works fine in
Netscape 7.2, Opera 8 and Firefox 1.04. In IE 6 the cookie isn't
written. I run WinXP SP2.
I'm trying to show a JavaScript alert reminding visitors about a
questionnaire on the site. I launch the alert in an onLoad-event, but
since I don't want to punish the visitors by showing the alert every
time they visit the page, I write a cookie when the alert-window is
| |
by: Marco Krechting |
last post by:
Hi All,
I have a page with a list of hyperlinks.
I want to save information in a cookie about the fact that I entered an
hyperlink or not.
When I click one of the hyperlinks I want this stored in a cookie and a
small bullit shown in front of the hyperlink,
so when I reload the page I can immediately see which hyperlinks I already
visited that day.
|
by: Joe |
last post by:
Hi folks,
Been looking at this for the day so any ideas would be appreciated. Here's
the scenario, bear with me - it looks more complicated than it is :)
I have a page templating system that inherits from the page class and adds a
mixture of usercontrols and literals when requested.
One of the usercontrols is a menu that expands on being clicked using DHTML.
What I'm trying to do is to persist the expanded menu to other pages or
|
by: Phil Powell |
last post by:
// OBTAINED FROM http://www.javascripter.net/faq/settinga.htm
// NOTE THAT IF YOU SET days TO -1 THE COOKIE WILL BE SET TO YESTERDAY
AND THUS EXPIRE
function setCookie(name, value, days, docObj) {
var today = new Date();
var expire = new Date();
if (days == null || isNaN(days) || days == 0) days = 1;
if (days >= 1 || days < 0) expire.setTime(today.getTime() + 3600000 *
24 * days);
|
by: mymatebob |
last post by:
Hi,
I am using cookies to keep track if a user is logged into my system,
and would like to display the time that the user has left logged in.
One solution is to display the time left until the cookie expires.
Does anyone know how to retrieve the expiry time of a particular
cookie?
TIA
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |