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

  1. <% @Language=JScript    %>
  2.  
  3. <%
  4.     // Because we might be redirecting, we must use buffering
  5.     Response.Buffer = true;
  6. %>
  7.  
  8. <HTML>
  9.     <HEAD>
  10.         <TITLE>Redirect Sample</TITLE>
  11.     </HEAD>
  12.  
  13.     <BODY bgcolor="white" topmargin="10" leftmargin="10">
  14.         
  15.         <!-- Display Header -->
  16.  
  17.         <font size="4" face="Arial, Helvetica">
  18.         <b>Redirect Sample</b></font><br>   
  19.  
  20.         <%
  21.             // If the referring page did not come
  22.             // from the sight "trainer3", Redirect
  23.             // the user to www.microsoft.com
  24.  
  25.             var referer = Request.ServerVariables("HTTP_REFERER");
  26.  
  27.             if (referer == "trainer3") 
  28.             {
  29.                 // They came from withing the trainer3
  30.                 // web site so we let them continue
  31.             }
  32.             else
  33.             {
  34.                 // They just linked from outside of the site
  35.                 Response.Redirect("http://www.microsoft.com");
  36.             }
  37.  
  38.  
  39.             // Flush Response Buffer
  40.             Response.Flush();
  41.         %>
  42.  
  43.     </BODY>
  44. </HTML>
  45.