Hello and welcome to the Webmasters Forums!. This is the best place to get webmasters resources for free. Get $2 for free today, read more - Make your payment today. Download premium and professional templates for free. Get free web hosting without ads, read more. You can get lot more by simply join with this forum. To gain full access to the forums you must sign up for a free account.


Post Reply  Post Thread 

ASP Cookies

Post Bank
Posting Manager
******

Posts: 995
Group: Forum Team
Joined: Sep 2006
Status: Online
Make money from now. You can make money just for posting on this forum. Every discussions on this community gives you more money. $2 minimum payout. So get your payment today, SignIn with this forum.

Signin to Remove this Post

robinson
Newbie


Posts: 18
Group: Registered
Joined: Sep 2006
Status: Offline
Reputation: 0
Points: 0 (Donate)
Post: #1

Wink 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, 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.

cookiesexample.asp

Code:
<% 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, as for example a list of links related to a specific theme, information to allow access to the content of a page or to personalize the page (background color, frames or not frames...), information to fill a form automatically, etc.

23-09-2006 01:37 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites
Rate This Thread:

Forum Jump:

Sign In to Remove Ads

Download 1000's of web templates. Unlimited access!
World's Best Web Hosting
Website of the Month

Create-a-Page for Free
SOTM June 2008


Accepting Submissions
for July 2008
Resources

Recommended Sites:



Visit our Sponsors!

Current time: 30-08-2008, 07:04 AM


Copyright © 2002-2008 MyBB Group
Powered By MyBB