Supporting Host Header Names in Older Browsers

Many older browsers do not support the use of host header names. If you are using host header names to host multiple sites on the same IP address and port, implementing the following procedures provides a way for visitors with older browsers to reach the correct site.

To configure the registry
  1. To open the registry for editing, type Regedt32.exe in a command window and press Enter.
  2. Enable or add the following keys in this location
  3. HKEY_LOCAL_MACHINE\SYSTEM
    
     \CurrentControlSet
    
      \Services
    
       \W3SVC
    
        \Parameters

    DLCSupport   Set the value of this parameter to 1 to enable support for browsers that are capable of passing cookies.

    DLCMenuString   This parameter supplies the special prefix of URLs that apply to the host menu. This is a special string that the server checks all down-level requests (that is, requests without a real HOST header) against. If the URL is prefixed by this string, then it is handled as a host menu item. For example, DLCMenuString can be set to "/HostMenu". Note the initial forward slash in the string.

    DLCMungeMenuDocumentString   This parameter is the name of the host menu document that will be sent to browsers that do not support cookies. For example, this parameter could be set to "/Scripts/Munge.asp".

    DLCHostNameString   This parameter supplies the host name of the Web site that contains the index documents. For example, if your menu page resides on www.server1.com, this parameter is set to "www.server1.com". Note that all files, such as images and backgrounds, must be located on the same Web site.

    DLCCookieMenuDocumentString   This parameter is the name of the actual host menu document to be sent to older browsers that support cookies. For example, this parameter could be "/Scripts/Cookies.asp".

    DLCCookieNameString   This parameter specifies the name of the special cookie to be interpreted by the server as representing a pseudo host header. For example, this parameter could be "PseudoHost".

 

To redirect the browser
  1. Place the following scripts in the Web site/Scripts directory, where Web site is the Web site identified in the DCLHostNameString registry setting.
  2. Copy this script into a text editor and name the file Munge.asp.
    <html>
    
    <head><title>Server Selection Page</title></head>
    
    
    
    <body>
    
    
    
    <a href="http://www.server1.com/*www.server1.com/<%=Request.QueryString()%>">Try Server 1</a><br>
    
    <a href="http://www.server1.com/*www.server2.com/<%=Request.QueryString()%>">Try Server 2</a><br>
    
    
    
    </body>
    
    </html>
    
    
    
    
  3. Copy this script into a text editor and name the file Cookie.asp.
    <html>
    
    <head><title>Server Selection Page</title></head>
    
    
    
    <body>
    
    
    
    <a href="/HostMenu/Scripts/Redirect.asp?Host=www.server1.com&NewLocation=<%=request.querystring()%>">Try Server 1</a><br>
    
    <a href="/HostMenu/Scripts/Redirect.asp?Host=www.server2.com&NewLocation=<%=request.querystring()%>">Try Server 1</a><br>
    
    
    
    </body>
    
    </html>
    
    
    
    
  4. Copy this script into a text editor and name it Redirect.asp.
    <%
    
    
    
    Option Explicit
    
    
    
    Dim DLCCookieNameString
    
    
    
    DLCCookieNameString = "PseudoHost"
    
    
    
    Response.Cookies(DLCCookieNameString) = Request.QueryString("Host")
    
    Response.Cookies(DLCCookieNameString).Domain = Request.QueryString("Host")
    
    Response.Cookies(DLCCookieNameString).Path = "/"
    
    
    
    Response.Redirect "http://" & Request.Querystring("Host") & Request.QueryString("NewLocation")
    
    
    
    %>			
    
    
    
    

© 1997 by Microsoft Corporation. All rights reserved.