home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_06.cab / samp3v72.asp < prev    next >
Text File  |  1997-09-29  |  3KB  |  40 lines

  1.  <% If Request("DontFrame")<>1 Then Response.Redirect "/iissamples/sdk/asp/docs/SampFram.asp?ovfile=/iishelp/iis/htm/sdk/samp3v72.asp&srcfile=Interaction/Redirect" %>
  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>Redirection</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="_redirection"></a>Redirection</h3>
  30. <p>
  31. Redirection is a powerful feature that you can use to efficiently structure and control access to your applications. For instance, if you have created an Intranet application for your company and wish to restrict access so that only your employees can access it, you could use the <b>Response.Redirect</b> method to divert unwanted visitors back to the public pages of your Intranet site. This example demonstrates how you could implement this feature. </p>
  32. <p>
  33. The sample script first fetches the specific server variable, HTTP_REFERER, from the collection <b>ServerVariables</b> provided by the built-in <b>Request</b> object, and checks to see if the request comes from a client browser's site that is considered safe. If the client browser is considered safe, the user is in luck and is allowed view to the contents of the page. If HTTP_REFERER doesn't match, however, <b>Response.Redirect</b> is called, and the client browser is sent to another site, www.microsoft.com in this case.</p>
  34. <p>
  35. <b>Note</b>  <b>Response.Redirect</b>, like several other methods, uses the HTTP headers of the response to communicate with the client browser. For this reason, it is generally required that methods such as these do their header changes before any HTML is sent, which means the statements must occur in the .asp file before the <HTML> tags. In this example, however, an alternative method is used. If buffering is enabled, as is the case in this example, the entire response should be accumulated in the response buffer before anything is sent. Therefore, <b>Response.Redirect</b> still works properly, even though it is in the middle of the file, because no HTTP headers have yet been sent to the client browser when the redirection is requested. </p>
  36. <hr class="iis" size="1">
  37. <p align="center"><em><a href="/iishelp/common/colegal.htm">© 1997 by Microsoft Corporation. All rights reserved.</a></em></p>
  38. </BODY>
  39. </HTML>
  40.