Forums

ASP

This topic is locked

problems with cookies

Posted 12 May 2003 22:09:24
1
has voted
12 May 2003 22:09:24 charles richardson posted:
Hello everyone. I'm new to these boards, so if I err, please forgive and any help will be most appreciative.

Ok, here's the problem I'm having. I'm unable to access a cookie or it's keys a page after setting them.
Here's the code I'm using to test things out..(taken from Teach Yourself ASP 3.0 in 21 days):

create cookies:
Response.Cookies("UserInformation"("LastVisit" = Now
Response.Cookies("UserInformation"("Name" = "Scott"
Response.Cookies("UserInformation"("UserAgentString" = Request.ServerVariables("HTTP_USER_AGENT"
Response.Cookies("UserInformation".Expires = Date + 7
Response.Redirect "listallcookies.asp"

Listallcookies.asp:
Dim cookie, key

For Each cookie in Request.Cookies

If Request.Cookies(cookie).HasKeys then

For Each Key in Request.Cookies(cookie)

Response.Write Key & " = " & Request.Cookies(cookie)(key)
Response.Write "<BR>"
Next

End If

Next


I've checked the settings for cookies in IE and it all looks normal, so if anyone has any suggestions or can spot what I'm doing wrong. I'd really appreciate it.

Replies

Replied 13 May 2003 22:19:03
13 May 2003 22:19:03 charles richardson replied:
UPDATE: Ok, if I change the following line from: Response.Redirect "<name>.asp" to Server.Transfer "<name>.asp" the cookie is passed without a problem.

Am I missing something? Shouldn't it work both ways?

Reply to this topic