PDA

Click to See Complete Forum and Search --> : How do you Create Cookies?


jesus4u
Feb 19th, 2001, 11:12 AM
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!

Clunietp
Feb 19th, 2001, 11:22 AM
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")

jesus4u
Feb 19th, 2001, 11:24 AM
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") ?

pactalon
Feb 19th, 2001, 02:14 PM
Jesus4u,

Check out http://www.w3scripts.com/asp/asp_cookies.asp tutorial for a lesson on ASP cookies.

Zaf Khan
Feb 19th, 2001, 10:45 PM
Also try this for the cookie expiry date


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
{;->