| 1. Asp Cookies Cookies method is very
similar to Session method: the basic difference is that with Cookies method
the information is save in the clients computer and not in the server. This
method implies sending information to the client and requesting it whenever
the information is needed.
When the visitor gets to our asp file we may save information related with
him in his computer.
<% response.Cookies ("abc")="information" %>
When this line is executed, the visitor will have the information in his
computer, and whenever we need that information, we may request it using
this code:
<% =request.Cookies ("abc") %>
or
<% variable1=request.Cookies ("abc") %>
let's consider we have visitors checking our site several times and we want
to let them know how many times they have accessed to our computer.
cookiesexample.asp
<% If Request.Cookies ("NumberVisits")="" Then %>
<% Response.Cookies ("NumberVisits")=1 %>
This is your first visit to this page. Welcome.
<% Else %>
<% VarNumberVisits=Request.Cookies ("NumberVisits")
VarNumberVisits=VarNumberVisits+1
Response.Cookies("NumberVisits")=VarNumberVisits %>
Welcome back to this page. You have visited this page <% =VarNumberVisits %>
times.
<BR>Check my great links
<BR>.....
<BR>.....
<% End If %>
Cookies method may be used to show visitors specific information we have
requested throw a form
|