Submited in: Asp
| Total Views: 27911
What is a cookie
A cookie is a small file that the server stores on the user's computer. Cookies are very useful and you can use them to store password, user last visit, etc.
How to create a cookie
Response.Cookies("YourWebSite")("UserName") = "Marc"
Response.Cookies("YourWebSite")("UserMail") = "email@example.com"
Response.Cookies("YourWebSite").Expires = Now() + 365
This will store the user's name and e-mail in the cookie "YourWebSite" on the computer.
Cookie will expire after 365 days from the time the cookie was put on the computer. How to retrieve a cookie value
In this example we will store cookie value in variable.
UserName = Request.Cookies("UserName")
UserMail = Request.Cookies("UserMail")
Response.write "Your name is:" & UserName & " and your mail is: " & UserMail