
January 24th, 2005, 04:13 PM
|
Contributing User
|
|
Join Date: Jan 2005
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
How to read and write cookies in ASP?
Hi I've been searching around and found a lot of sample code but none seem to be working for me. Can someone here help?
This is what I have for writing:
' Sometimes writting the cookie, so I kill it first.
Response.Cookies("MySite")("var1")=var1
response.cookies("MySite").Expires=Date() -1
' Really where I write the cookie.
Response.Cookies("MySite")("var1")=var1
Response.Cookies("MySite")("var2")=var2
response.cookies("MySite").Expires=#January 1,2025#
This is what I have for reading:
var1 = Request.Cookies("MySite")("var1")
var2 = Request.Cookies("MySite")("var2")
var1 and var2 are always empty. When I go to view the cookied that was written, through IE Tools > Internet Options ... my cookie is simply named '[sitename]' rather than 'cookie:user@site.com'. I think this may be the reason I can't read the cookie. Now when I open the cookie in notepad, it looks correct.
MySitevar1=FirstVar&var2=SecondVarlocalhost/MySite1024430100483115316269161793629688409*
Any help would be much appreciated.
|