Introduction to Cookies Method

Tutorials Shared by the Internet Community

Advertisements


Synopsis

A basic information on using Cookies in ASP. An access counter is used as an example.

Statistics

  • Total Hits - 27866

  • Total Votes - 104 votes

  • Vote Up - 45 votes

  • Vote Down - 59 votes

  • Domain - www.asptutorial.info

  • Category - ASP/Cookies and Sessions

  • Submitted By - Devesh Khanna

  • Submitted on - 2008-03-06 09:00:44

Description

ookies 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, so it is more suitable for sites with a lot of visitors. This method implies sending information to the client and requesting it whenever the information is needed. Additionally, we will learn how to delete the information save in the clients computer when it is not necessary anymore.

When the visitor gets to our asp file we may save information related with him in his computer. The order will be like this one:

<% response.Cookies ("whatever")="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 ("whatever") %>
or
<% variable1=request.Cookies ("whatever") %>


Let's try an example using Cookies method: 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. ...


Site  |   Broken  |   Tweet  |   Facebook  |     |   Save  |   Liked  |   Down

Advertisements