home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_07.cab / Cookie_VBScript.asp < prev    next >
Text File  |  1997-10-25  |  2KB  |  63 lines

  1. <%@ LANGUAGE = VBScript %>
  2. <%  Option Explicit     %>
  3.  
  4. <%
  5.     ' Changes to the HTTP response header, in which cookies
  6.     ' are sent back to the client, must be made before
  7.     ' sending any data to the user.
  8.     
  9.     Response.Expires = 0
  10.         
  11.     
  12.     ' Get the last visit date/time string from the cookie that
  13.     ' resides in the http request header.
  14.     
  15.     Dim LastVisitCookie
  16.     LastVisitCookie = Request.Cookies("CookieVBScript")
  17.     
  18.     
  19.     ' Send the current date/time string in a cookie enclosed
  20.     ' in the response header.  Note that because IE now uses
  21.     ' case-sensitive cookie paths, we have explicitly set
  22.     ' the cookie path to be that of the url path to this
  23.     ' page.  By default, the path would be that of the
  24.     ' IIS Application context for this page ("IISSAMPLES")
  25.     
  26.     Response.Cookies("CookieVBScript") = FormatDateTime(NOW)
  27.     Response.Cookies("CookieVBScript").Path = "/IIsSamples"
  28. %>
  29.  
  30.  
  31. <HTML>
  32.     <HEAD>
  33.         <TITLE>Using Cookies</TITLE>
  34.     </HEAD>
  35.  
  36.     <BODY BGCOLOR="White" topmargin="10" leftmargin="10">
  37.  
  38.         <font size="4" face="Arial, Helvetica">
  39.         <b>Using Cookies</b></font><br>
  40.       
  41.         <hr size="1" color="#000000">
  42.         
  43.         <%        
  44.             If (LastVisitCookie = "") Then
  45.             
  46.                 ' The cookie has never been set. This must
  47.                 ' be the user's first visit to this page.
  48.                 
  49.                 Response.Write("Welcome to this page.")
  50.             Else
  51.  
  52.                 ' Remind the user of the last time she/he
  53.                 ' visited this page.
  54.  
  55.                 Response.Write("You last visited this page on " + LastVisitCookie)
  56.             End If        
  57.         %>
  58.  
  59.         <p><A href="Cookie_VBScript.asp">Revisit This Page</A>
  60.  
  61.     </BODY>
  62. </HTML>
  63.