home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 September / CHIPCD_9_99.iso / software / uaktualnienia / OptionPackPL / iis4_06.cab / samp2kdv.asp < prev    next >
Text File  |  1998-04-27  |  3KB  |  42 lines

  1.  <% If Request("DontFrame")<>1 Then Response.Redirect "/iissamples/sdk/asp/docs/SampFram.asp?ovfile=/iishelp/iis/htm/sdk/samp2kdv.asp&srcfile=Interaction/Cookie" %>
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  3. <HTML>
  4. <HEAD>
  5. <META HTTP-EQUIV="Content-Type" Content="text-html; charset=Windows-1252">
  6. <title>Using Cookies</title>
  7. <script language="JavaScript">
  8.  
  9.     szNavVersion = navigator.appVersion
  10.  
  11.     if (navigator.appName == "Microsoft Internet Explorer") {
  12.     if (szNavVersion.indexOf ("4.") >= 0) {
  13.         document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/spidie4.css">');
  14.     } else {
  15.         document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/spidie3.css">');
  16.     }
  17.     }
  18.     else if (navigator.appName == "Netscape") {
  19.     document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/spidie4.css">');
  20.     }
  21.     else {
  22.     document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/spidie3.css">');
  23.     }
  24.  
  25. </script>
  26. <META NAME="DESCRIPTION" CONTENT="Internet Information Server reference information"></HEAD>
  27. <BODY BGCOLOR=#FFFFFF TEXT=#000000>
  28. <font face="Verdana, Arial, Helvetica">
  29. <h3><a name="_using_cookies"></a>Using Cookies</h3>
  30. <p>
  31. You can use cookies to store information about a particular client, session, or application. You can then use this information to intelligently customize and streamline a client browser's session. </p>
  32. <p>
  33. This sample illustrates how your application can query the value of a particular cookie. IIS makes cookies available to ASP scripts through the <b>Request.Cookies</b> collection. This example first queries the cookie CookieVBScript or CookieJScript by using the standard collection-access format, <i>object.collection</i>(<i>keyname</i>). It then resets that cookie to the current date and time.</p>
  34. <p>
  35. If the initial query yields a null string, that indicates the client browser has never visited the page in question before; and a first-time welcome message is displayed. If a value was returned by the initial query of CookieVBScript or CookieJScript, however, it indicates not only that the client browser has visited before, but when that last visit took place.</p>
  36. <p>
  37. <b>Note</b>  IIS sends all HTTP headers required for a given Web page or script before any HTML is sent to the client browser. Therefore, all statements and methods that modify the HTTP headers of the response, including setting of the <b>Response.Cookies</b> collection members, must be located before the <HTML> tag in your script. If your script attempts to modify the HTTP headers after the server has begun sending HTML content back to the client browser, the script will generate an error. </p>
  38. <hr class="iis" size="1">
  39. <p align="center"><em><a href="/iishelp/common/colegal.htm">© 1997 by Microsoft Corporation. All rights reserved.</a></em></p>
  40. </BODY>
  41. </HTML>
  42.