ASP - VBScript - Welcome Cookie

Posted last year, at the start of March by Dave.
Categories: ASP, VBScript, Snippets.
Post Views: 3,217 Views.

The following VBScript snippet will write a cookie based Welcome Message and count the number of times they have visited.

Code (asp)
  1.  
  2.         Dim numvisits
  3.         Response.Cookies("NumVisits").Expires = Date+365
  4.         numvisits = Request.Cookies("NumVisits")
  5.  
  6.         If numvisits = "" Then
  7.                 Response.Cookies("NumVisits") = 1
  8.                 Response.Write("Welcome! This is the first time you are visiting this Web page.")
  9.         Else
  10.                 Response.Cookies("NumVisits") = numvisits + 1
  11.                 Response.Write("You have visited this ")
  12.                 Response.Write("Web page " & numvisits)
  13.                 If numvisits = 1 Then
  14.                         Response.Write(" time before!")
  15.                 Else
  16.                         Response.Write(" times before!")
  17.                 End if
  18.         End If
  19.  

Last 5 posts in ASP

Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
    del.icio.usDe.lirio.usdiggFurlRedditYahooMyWeb

0 comments. Print Print Email Email Download a PDF version of this post. PDF
, ,  

Leave a comment

Comments can contain some xhtml. Names and emails are required (emails aren't displayed), url's are optional.




Note: This post is over a year old. You may want to check later in this blog to see if there is new information relevant to your comment.

It took a bunch of illegal immigrants locked in a basement, 0.636 seconds to make this page.