| View previous topic :: View next topic |
| Author |
Message |
dnadave
Joined: 19 Jun 2006 Posts: 3
|
Posted: Mon Jun 19, 2006 5:31 pm Post subject: Persistent Cookies |
|
|
I'm currently trying to learn ASP and BabyWS has worked great for me. Except, I did come across one issue.
I am using the following code to set a cookie to "dave"...
<% Response.Cookies("loginuser")="dave" %>
<% Response.Cookies("loginuser").Expires = Now() + 100 %>
I am using the following code to check for that same cookie...
<% if (Response.Cookies("loginuser")="") then %>
No Cookie
<% else %>
<%= Response.Cookies("loginuser") %></a>
<% end if %>
For some reason, it is acting like a Session object. The cookie is removed when I close the browser. Any thoughts?
-Dave |
|
| Back to top |
|
 |
admin Site Admin
Joined: 13 Apr 2005 Posts: 1467
|
Posted: Mon Jun 19, 2006 9:00 pm Post subject: |
|
|
Note that cookies are a feature of your browser, so it's up to your browser if it will store the cookie or not (based on your security settings).
Usually the .Expires method is used this way:
| Code: | | Response.Cookie("loginuser").Expires = DateAdd("d", 7, Now()) |
or
| Code: | | Response.Cookies("loginuser").expires = #12/31/2029 00:00:00# |
I'm not sure if VBSCRIPT will understand that Now() + 100 should result in a date. |
|
| Back to top |
|
 |
dnadave
Joined: 19 Jun 2006 Posts: 3
|
Posted: Tue Jun 20, 2006 6:53 pm Post subject: Sill no solution |
|
|
I tried your suggestions and they set Session Cookies as well, not Persistent Cookies.
I know my browser allows for persistent cookies, because many other websites track my login/password without me having to login (and I see the cookies on my machine).
Where are Cookies stored on the machine when generated in ASP by BabyWS? |
|
| Back to top |
|
 |
admin Site Admin
Joined: 13 Apr 2005 Posts: 1467
|
Posted: Tue Jun 20, 2006 8:58 pm Post subject: |
|
|
Like I said in my previous message, cookies are a feature of your browser, so depending on the type of browser you use, the location where the cookies are stored is different. BabyWebServer only controls the content of the cookie file but not it's location or filename.
IE normally stores cookies in your personal folder:
C:\Documents and Settings\YourName\Cookies
The name depends on the URL you used to access the server.
For example:
http://127.0.0.1
results in a cookie file:
yourname@127.0.0.1.txt
Once again, this may be different depending on your browser configuration, (local) security settings.
Note that if cookies from other Web Sites do work, you might have to change your local security settings. |
|
| Back to top |
|
 |
|