Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where are my Cookie values??

Status
Not open for further replies.

rossno

Programmer
Feb 8, 2002
46
US
I create a keyed cookie like this:

Response.cookies("thisUser")("p_userID") = p_userID

Response.cookies("thisUser")("p_first") = trim(resultSet("FirstName"))

Response.cookies("thisUser")("p_password") = p_password

Response.cookies("thisUser")("p_email") = trim(resultSet("Email"))

BEFORE the <HTML> tag in my logon.asp.

In my forum.asp, I what to retrieve the cookie values, but I am shocked to see that they are gone. ie:

Dim p_userID, p_email, p_password


p_userID = Request.Cookies(&quot;thisUser&quot;)(&quot;p_userID&quot;)
p_email = Request.Cookies(&quot;thisUser&quot;)(&quot;p_email&quot;)
p_password = Request.Cookies(&quot;thisUser&quot;)(&quot;p_password&quot;)

response.write p_userID & &quot; - &quot; & p_email & &quot; - &quot; & p_password & &quot; - &quot; & Request.QueryString(&quot;action&quot;)

... just prints the dashes with no values.
I just searched my c: and do not have a Global.asa file.
Is that mandatory?

Thanks in advance, Norm

 
Global.asa is not mandatory.

Is your browser setup to accept cookies? If not, there's a 99% chance that that's the problem. (did you try with a different browser?)

Let me know. -Ovatvvon :-Q
 
I just lowered my cookie guard all the way on IE (the only browser that I am running). Just tested again and got the same result. Early this morning, I DID GET values in my cookies intermittently. Nuts.

PS I deleted all old cookies on my computer, and started over before the above test.
 
In IE 6, you can lower the privacy settings to accept more, there is also an &quot;advanced&quot; button. Click on that and you have the option (checkbox) to &quot;override automatic cookie handling&quot;. Try setting that to ACCEPT first and third party cookies and retry your web site.

Let me know how that works. -Ovatvvon :-Q
 
It has always been my understanding that your cookie will only have session scope unless you explicitly set the expires property. Thus, your cookie values will disappear when you close your browser.

If this is the problem that you are experiencing, simply set the expiry date of your cookie:

'cookie will expire in one year
Response.Cookies(&quot;thisUser&quot;).Expires = Date() + 365
 
Yes that's true JuanitaC, Thanks for mentioning that, I completely forgot about it. -Ovatvvon :-Q
 
I finally found my cookies.

NOTE that I am redirecting ASP from a Hawk Comm. Server to a WinSave Server. Had to give up on Hawk, because I couldn't get an Access DB connection to work there (tried for 4 days). Took 10 minutes on WinSave.

When I use the URL for on the Hawk Server (redirected to WinSave), the cookies work fine. When I (apparently) short circuit the URL and go directly to the WinSave server, to save and retrieve my Cookies, ... they save and retrieve values O.K. on the same page, but are lost when I traverse to a different page. I think all will be O.K. when (or if) Network Solutions finally (2 weeks so far) transfers my domain from Hawk to WinSave so that this site will have a (semi) permanent home .

Thanks for the help Everybody. If I find out WHY my &quot;short circuit&quot; URL loses my Cookies, I will let you know here.

Norm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top