-
Hello all. I am new to writing cookies. I have a website and my user registration and log in page work fine. I can limit their session on the site by using a session variable but I now want to use cookies to recognize my registered users and populate various fields automatically so that my site becomes more functional.
Who can help and show me the code?
thanks!
-
This should work, double check the Expires property though....
To write a cookie
Response.Cookies("MyCookie") = "Hello World!"
Response.Cookies("MyCookie").Expires = "1/1/2002"
To read a cookie
response.write request.cookies("MyCookie")
-
forgive me for my dumbness but do I insert the
Response.Cookies("MyCookie") = "Hello World!"
Response.Cookies("MyCookie").Expires = "1/1/2002"
AFTER they log in or while they log in?
And after that where do I place the
response.write request.cookies("MyCookie") ?
-
Jesus4u,
Check out http://www.w3scripts.com/asp/asp_cookies.asp tutorial for a lesson on ASP cookies.
-
Also try this for the cookie expiry date
Code:
Response.Cookies("MyCookie").Expires = Date() + 30
or
Response.Cookies("MyCookie").Expires = Date() + 60
to make cookie expire after 30 or 60 days
rather than entering a dtae cos yo make a typo
DocZaf
{;->