cookies!
Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=21079
Printed Date: 29 March 2026 at 3:39am Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com
Topic: cookies!
Posted By: frufru
Subject: cookies!
Date Posted: 19 August 2006 at 7:05pm
I'm working on my self-serve image randomizer system, and it is very well available for use: http://random.mrfrufru.com , and I just can't figure out how to make a cookie not expire until you click logout. There's people saying they don't get the cookie at all or the cookie disappears when they close their browser. I see that is working well on this forum. I tried looking through the code but I couldn't find it. Suppose I have this:
response.cookies("username")=user response.cookies("password")=pass if request.form("minutes")<>"-1" then response.cookies("password").Expires = DateAdd("n", request.form("minutes"), Now()) else response.cookies("password").Expires = DateAdd("yyyy", 2, Now()) end if
The login form has a drop-down named "minutes" and it gives the number of minutes the user selected to stay logged in, and -1 if they selected forever. So what do I need to do to make it work?
|
Replies:
Posted By: site master
Date Posted: 20 August 2006 at 3:52pm
try this:
response.cookies("username")=user response.cookies("password")=pass if request.form("minutes")<>"" then response.cookies("password").Expires = DateAdd("n", request.form("minutes"), Now()) else response.cookies("password").Expires = DateAdd("yyyy", 2, Now()) end if
|
-------------
|
Posted By: frufru
Date Posted: 21 August 2006 at 2:24pm
|
meh. nevermind. I got it working. I had to set the Expires property for both the username and password :P
|
|