Sometime, after a first visit on a site you may have the feeling that this site recognizes you when re-visiting it… This is true! because a file (you are not aware of) is stored on your hard drive... But, let's explore this issue…
Unless you have already deactivate this possibility in the parameters of your browser, you must have a folder totally full up on your hard drive … C:\WINDOWS\Cookies Full of small .txt files; each one containing information that was written by a site during your last visit (or session). This information will be read during your next visit to the same site so that the site will be able to recognize you...
A cookie includes information such as:
its name: requirement!
some content: if empty, the cookie is removed!
an expiration date: if not the cookie will not survive after the session!
How to do it?
Read a cookie by using the Cookies function of the Request object:
<% if Request.Cookies("email")<>"" then%> Unsubscribe <%else%> Subscribe <%end if%>
Write a cookie by using the Cookies method of Response object:
<% Response.Cookies("email")="info@truc.com" Response.Cookies("email").Expires = Date+365 ' 1 year ! %>