473,774 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

set cookies to expire

How can I set my cookies to expire when the the user leaves the site?
Jan 10 '06 #1
2 1950
if you want that one way is to use session variables not cookies..
"Gonzosez" <no****@home.co m> wrote in message
news:OR******** ******@TK2MSFTN GP11.phx.gbl...
How can I set my cookies to expire when the the user leaves the site?

Jan 10 '06 #2
I agree that if you don't want a cookie to last longer than a session,
then use session variables. But anyways here is an answer to your
question about having a cookie quickly expire.

Cookie Monster: Using Cookies in ASP
By Ian Stallings
http://www.4guysfromrolla.com/webtech/051099-1.shtml
<<
The next important property is the Expires property. This specifies the
date the cookie should expire. If it is set to a past date then it will
expire when the browser is closed.

When setting the date it can be set a couple of ways. You can use the
current date and add or subtract days like so:

Response.Cookie s("name").Expir es = Date + 365


Best regards,
J. Paul Schmidt, Freelance Web and Database Developer
http://www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips

Jan 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2247
by: Bert | last post by:
I have been reading the post and the FAQ and have been unable to find anything that will help with my problem. First let me say that I am not a web developer, designer and no next to nothing about javascript. I am just rebuilding my site and need help. We run a bamboo nursery and the site has listings of over 100 varieties we sell. The site uses regular pages and framesets for the discriptions of the bamboo. The framesets have a top...
6
2119
by: Marcus | last post by:
Hello all, This is baffling me. I am starting a session and I know it is setting a cookie on my computer - I called getallheaders() and see that it is setting the cookie, and it is also accessible in $_COOKIE. I cleared all cookies in my Cookies folder before starting the session, and everytime I run the script it does not create a cookie in the folder. For testing I even set the browser to accept all cookies to make sure. ...
12
1699
by: Mike | last post by:
Hello, I have been trying to get cookies to work. It seems I can get this cookie to be persistant in the browser but I want to write it to my Cookies Folder. I have tried many variations but when I look in the folder there is nothing there from my Domain. This is a simlified version but, I have tried many things. What am I missing? Yes I allow all cookies Thanks Mike
3
3855
by: Joey Powell | last post by:
This message was originally posted to the aspnet.security newsgroup, but no one there has ever heard of this before. That is why I am posting this message here, so that more people will see it... On my asp.net application, suddenly the forms authentication cookies for clients have quit expiring. This results in users being able to access the site from day to day without having to log in, even if their browers are closed and reopened...
1
988
by: Joe | last post by:
Hi, I’m creating a cookie named “tick” that should expire after 1 day when user logs in. TheDomain = ".www.test.com" ThePath = "/dir1/subdir" Response.Cookies("tick")("ID") = Session("userEmail") Response.Cookies("tick").Expires = DateAdd("d", 1, Now()) Response.Cookies("tick").Domain = TheDomain
2
2743
by: pv_kannan | last post by:
I recently found out that my authentication cookies are not expiring even though I have set the persist property to false. As a result, users are able to access the secure websites with indifferent results. Any pointers/suggestions would be very appreciated. Things were running as usual till until recently. Here are the relevant pieces of code ==========================================
5
13790
by: Jono | last post by:
Hi Everyone, Most tutorials I've seen address cookies from the server's perspective, assuming that the client (usually a browser like Internet Explorer) will manage the persistence. I am faced with writing a C#.NET client that uses a web reference to a SOAP web service, and I need to persist the cookies myself, or so it seems. The cookies stored in temporary internet files - accessed each time I hit the web service help page from IE...
6
2675
by: knkk | last post by:
I am not able to locate the cookies created by the setCookie function. They are not in the standard IE folder where temporary Internet files and cookies are placed. Does anyone know where I search, or how I trace them? Also, I created cookies using this command: $string_to_check = $type."_".$pid; setCookie("$string_to_check", "1", time()+30*1); The cookie doesn't expire in 30 seconds - in fact, it doesn't seem to expire at all.
3
3164
by: Inny | last post by:
I want To offer a login Option, two Checkboxs, 1 labeled 'normal' the other labeled 'Forever'. I want to assign the check boxes to switch between the cookie script below (normal) and An altered version of the cookie script 'forever' Which will not expire but require deletion from the users pc. I need help to alter the cookie code below NOT to expire. I need help to write a javascript to switch between the two according to user prefrence...
0
9621
marktang
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10040
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,...
0
6717
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4012
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
3
2852
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.