Write cookies using ASP with this tutorial. Cookies are a good way to keep information handy while interacting with the client. No matter how you feel about cookies, good bad or indifferent, they are an integral part of many webs. Why not unlock the mystery and write your own?
Nuts Own Code

Asp Directory

Nuts Web Search
Web Directory
Web Search

Nuts ASP Code
Functions
Scripts
Tutorials
Wizards
Fonts
Download Fonts
Download Dll Files
Dll Files
Relaxing Games
Online Games
Take Our Poll
Do you use .Net?
Yes
No
Not Yet
Dot What?
Really, Take It!
Get The Source
About Nuts4Asp
Privacy
Contact Us
Arts
Movies, Television, Music
Business
Jobs, Industries, Investing
Computers
Internet, Software, Hardware
Games
Video Games, RPGs, Gambling
Health
Fitness, Medicine, Alternative
Home
Family, Consumers, Cooking
Kids and Teens
Arts, School Time, Teen Life
News
Media, Newspapers, Weather
Reference
Maps, Education, Libraries
Regional
US, Canada, UK, Europe
Science
Biology, Psychology, Physics
Sports
Baseball, Soccer, Basketball
World
Deutsch, Español, Français, Italiano, Japanese, Nederlands, Polska, Svenska
Help build the largest human-edited directory of the web
Here's a quick rundown on this.

<%
Response.Cookies("nuts")=1
Response.Cookies("nuts").Expires="June 15, 2005"
%>

By adding this code to the top of your page you will drop a cookie on the client. One way to use this is to determine if a user has been to your site before. This cookie is set to expire on June 15 2005.

Now if you want the cookie to expire when they leave just don't give it an expiration like so:

<%
Response.Cookies("nuts")=1
%>

Here's how to read the cookie and use it to display a greeting:

<%
If Request.Cookies("nuts") = 1 Then
  greet = "Welcome Back To Nuts4asp"
Else
  greet = "Welcome To Nuts4asp"
End If
Response.Write greet
Response.Cookies("nuts")=1
Response.Cookies(nuts").Expires="June 15, 2005"
%>

Now you will note that I set the cookie AFTER I checked for it. This is because if we write the cookie before checking, it would always say Welcome Back.

There's the basic recipe for cookies.

Bad or missing query parameters in request.

Copyright © 2001-2008 Nuts4Asp.com
All other names used are property or copyright of their respective owners.