Customizing Web Site Content and HTTP Headers


IIS sets default values for documents and Hypertext Transfer Protocol (HTTP) headers. You can modify these default values at the site, directory, and file level.

Configuring Default Documents

Default document settings determine how IIS handles requests that don’t specify a document name. If a user makes a request using a directory path that ends in a directory name or forward slash (/) rather than a file name, IIS uses the default document settings to determine how to handle the request.

When default document handling is enabled, IIS searches for default documents in the order in which their names appear in the default document list and returns the first document it finds. If a match isn’t found, IIS checks to see if directory browsing is enabled and, if so, returns a directory listing. Otherwise, IIS returns a 404—File Not Found error.

You can configure default document settings at the site or directory level. This means that individual directories can have default document settings that are different from the site as a whole. Standard default document names include Default.htm, Default.asp, Index.htm, and Index.html.

You can view current default document settings or make changes by following these steps:

  1. In the IIS snap-in, right-click the Web site, virtual directory, or directory you want to work with and then choose Properties.

  2. Select the Documents tab. The Enable Default Content Page check box determines whether default documents are used. To turn on default document handling, select this check box. To turn off default document handling, clear this check box.

  3. To add a new default document, click Add. Next, type the name of the default document, such as Index.html, and then click OK.

  4. To remove a default document, select it in the list provided, and then click Remove.

  5. To change the search order, select a document, and then click either Move Up or Move Down.

  6. Click OK.

Configuring Document Footers

You can configure IIS to automatically insert an HTML-formatted footer document on the bottom of every document it sends. The footer can contain copyright information, logos, or other important information. As with default documents, you can configure document footers at the site or directory level. This means that individual directories can have different footer settings from the site as a whole.

Enabling Automatic Footers

To configure automatic footers, follow these steps:

  1. Create an HTML-formatted document and save it to a folder on a Web server’s local hard disk drive. The footer document shouldn’t be a complete HTML page. Instead, it should include only the HTML tags necessary for content that’s to be displayed in the footer.

  2. In the IIS snap-in, right-click the Web site, virtual directory, or directory you want to work with and then choose Properties.

  3. Select the Documents tab and then select the Enable Document Footer check box.

  4. In the field provided, type the path to the footer file or click Browse to display the Open dialog box, which you can use to find the file.

  5. Click OK.

Disabling Automatic Footers

To disable automatic footers, follow these steps:

  1. In the IIS snap-in, right-click the Web site, virtual directory, or directory you want to work with and then choose Properties.

  2. Select the Documents tab and then clear the Enable Document Footer check box.

  3. Click OK.

Using Content Expiration and Preventing Browser Caching

Most browsers store documents that users have viewed in cache so that the documents can be displayed later without having to retrieve the entire page from a Web server. You can control browser caching using content expiration. When content expiration is enabled, IIS includes document expiration information when sending HTTP results to a user. This enables the browser to determine if future requests for the same document need to be retrieved from the server or whether a locally cached copy is still valid.

You can configure content expiration at the site, directory, or file level. Site level settings affect all pages in the site. Directory level settings affect all files in the directory and subdirectories of the directory. File level settings affect the currently selected file only. Three content expiration settings are available:

  • Expire Immediately Forces cached pages to expire immediately, preventing the browser from displaying the file from cache. Use this setting when you need to make sure that the browser displays the most recent version of a dynamically generated page.

  • Expire After Sets a specific number of minutes, hours, or days during which the file can be displayed from cache. Use this setting when you want to ensure that the browser will retrieve a file after a certain period.

  • Expire On Sets a specific expiration date and time. The file can be displayed from cache until the expiration date. Use this setting for time-sensitive material that’s no longer valid after a specific date, such as a special offer or event announcement.

    Tip

    In ASP pages you can control content expiration by putting a Response.Expires entry in the HTTP header. Use the value Response.Expires = 0 to force immediate expiration. Keep in mind that HTTP headers must be sent to the browser before any page content is sent.

Enabling Content Expiration

You set content expiration on site, directory, and file levels. Keep in mind that individual file and directory settings override site settings. So if you don’t get the behavior you expect, check for file or directory settings that might be causing a conflict.

You can configure content expiration for a site, directory, or file by completing the following steps:

  1. In the IIS snap-in, right-click the site, directory, or file you want to work with and then choose Properties.

  2. Choose the HTTP Headers tab, and then select the Enable Content Expiration check box.

  3. To force cached pages to expire immediately, select Expire Immediately.

  4. To set a specific number of minutes, hours, or days before expiration, select Expire After, and then configure the expiration information using the fields provided.

  5. To set specific expiration date and time, select Expire On, and then configure the expiration information using the fields provided.

  6. Click OK.

Disabling Content Expiration

You set content expiration on site, directory, and file levels. Keep in mind that individual file and directory settings override site settings. So if you don’t get the behavior you expect, check for file or directory settings that might be causing a conflict.

You can disable content expiration for a site, directory, or file by completing the following steps:

  1. In the IIS snap-in, right-click the site, directory, or file you want to work with and then choose Properties.

  2. Select the HTTP Headers tab and then clear the Enable Content Expiration check box.

  3. Click OK.

Using Custom HTTP Headers

When a browser requests a document on a Web site handled by IIS, IIS normally passes the document with a response header prepended. Sometimes you might want to modify the standard header or create your own header for special situations. For example, you could take advantage of HTTP headers that are provided for by the HTTP standards, but for which IIS provides no interface. Other times you might want to provide information to the client that you couldn’t pass using standard HTML elements. To do this, you can use custom HTTP headers.

Custom HTTP headers contain information that you want to include in a document’s response header. Entries in a custom header are entered as name value pairs. The Name portion of the entry identifies the value you’re referencing. The Value portion of the entry identifies the actual content you’re sending.

Custom HTTP headers typically provide instructions for handling the document or supplemental information. For example, the Cache-Control HTTP header field is used to control how proxy servers cache pages. A field value of Public tells the proxy server that caching is allowed. A field value of Private tells the proxy server that caching isn’t allowed.

To view or manage custom HTTP headers for a site, directory, or file, follow these steps:

  1. In the IIS snap-in, right-click the site, directory, or file you want to manage and then choose Properties.

  2. Select the HTTP Headers tab. The Custom HTTP Headers frame shows currently configured headers in name: value format.

  3. Use the following options to manage existing headers or create new headers:

    • Add Adds a custom HTTP header. To add a header, click Add. Type a header name and then type a header value. Complete the process by clicking OK.

    • Edit Edits a custom HTTP header. To edit a header, select it, and then click Edit. Use the Properties dialog box provided to change the header information, and then click OK.

    • Remove Removes a custom HTTP header. To remove a header, select it and then click Remove.

  4. Click OK to close the Properties dialog box for the site, directory, or file you’re working with.

Using Content Ratings

IIS has a built-in content rating system based on the Platform for Internet Content Selection (PICS) system. PICS was developed by the Recreational Software Advisory Council (RSAC), now called the Internet Content Rating Association (ICRA), and it’s based on the work of Dr. Donald Roberts of Stanford University. Under the PICS rating system, content can be rated according to levels of violence, sex, nudity, and offensive language. Each rating has a separate threshold level that goes from level 0, in which no elements of the designated category are found, to level 4, in which explicit materials are used.

You can set content ratings for an entire site, individual directories, and individual files. Before setting content ratings, you should fill out an ICRA questionnaire to obtain the recommended content ratings for the type of content.

Enabling Content Ratings

To set content ratings for a site, directory, or file, follow these steps:

  1. In the IIS snap-in, right-click a site, directory, or file and then select Properties.

  2. Select the HTTP Headers tab and then, under Content Rating, click Edit Ratings.

  3. On the Ratings tab select the Enable Ratings For This Content check box.

  4. In the Category list box, click a ratings category and then use the rating slider to set the level of potentially objectionable material for the category. Each setting displays a description of the rating level.

  5. Type your e-mail address in the E-Mail Address Of Person Rating This Content field, and then use the Expire On selection list to choose a ratings expiration date.

  6. Click OK twice.

Disabling Content Ratings

To disable content ratings for a site, directory, or file, follow these steps:

  1. In the IIS snap-in, right-click a site, directory, or file and then select Properties.

  2. Select the HTTP Headers tab and then, under Content Rating, click Edit Ratings.

  3. On the Ratings tab clear the Enable Ratings For This Content check box.

  4. Click OK twice.




Microsoft IIS 6.0Administrator's Consultant
Microsoft IIS 6.0Administrator's Consultant
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 116

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net