ASP 101 - Active Server Pages 101 - Web05
The Place ASP Developers Go!

Windows Technology Windows Technology
15 Seconds
ASP 101
ASP Wire
VB Forums
VB Wire
internet.commerce internet.commerce
Partners & Affiliates
ASP 101 is an site
ASP 101 is an site
Internet News
Small Business
Personal Technology

Corporate Info
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash

 Top ASP 101 Stories Top ASP 101 Stories
Connections, Commands, And Procedures
What is ASP?
VBScript Classes: Part 1 of N

Encapsulate business logic in components
Show All Tips >>
ASP 101 RSS Feed ASP 101 Updates

Quick Tips

Using Cookies in your ASP page

Cookies, those small files that live in the Temporary Internet Files folder, are a great way to personalize your ASP pages. The following ASP code creates a page that will ask a user to enter their name the first time they visit the page, then recognize and greet them by name each subsequent visit.

If Not Request.Form("Name") = "" Then
    Response.Cookies("Name") = Request.Form("Name")
    Response.Cookies("Name").Expires = "Jan 1, 2010"
End If
 <title>Welcome Page</title>
If Request.Cookies("Name") = "" Then
    Response.Write "<form method=""post"">Enter Your Name: "
    Response.Write "<input type=""text"" name=""name"">"
    Response.Write "<input type=""submit"">"
    Response.Write "</form>"
    Response.Write "Welcome back, " & Request.Cookies("Name")
End If

Previous      Show All Tips      Next

If you have a tip you would like to submit, please send it to:

Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback
The Network for Technology Professionals



Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers