Configure an Output Caching Rule Using Query Strings (IIS 7)

Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista

You can configure a rule that is based on parameters sent in a query string from a client request that will cache different versions of content for your site or for an application. For example, you might have a product catalog application that returns different versions of a page, based on a product ID parameter. You can configure an output cache rule to cache different versions of a page. The version of the page would be based on the product ID value that the client passes in the query string when a user requests a resource from your site or application.


For information about the levels at which you can perform this procedure, and the modules, handlers, and permissions that are required to perform this procedure, see Output Caching Feature Requirements (IIS 7).

Exceptions to feature requirements

  • None

To configure an output cache rule using query strings

You can perform this procedure by using the user interface (UI), by running Appcmd.exe commands in a command-line window, by editing configuration files directly, or by writing WMI scripts.

User Interface

To use the UI

  1. Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager, see Open IIS Manager (IIS 7). For information about navigating to locations in the UI, see Navigation in IIS Manager (IIS 7).

  2. In Features View, double-click Output Caching.

  3. Click Add in the Actions pane.

  4. In the Add Cache Rule dialog box, in the File Name Extension box, enter the file name extension, such as .aspx, for which you want to create a cache rule.

  5. Select the User-mode caching check box to enable output caching, and select one of the following options:

    • Using file change notification: if you want an item to be removed from the cache when it is updated.

    • At time intervals (hh:mm:ss): if you want an item to be removed from the cache after a certain time elapses.

    • Prevent all caching: to prevent all caching of the designated file type.

  6. Click Advanced.

  7. In the Advanced Output Cache Rule Settings dialog box, click to select Query string variable(s) under Cache different versions of a file based on.

  8. Type a query string variable, such as local or culture, in the Query string variable(s) box and then click OK.

Command Line

To <do_something>, use the following syntax:

appcmd command object parameter:value | parameter:variable | parameter:option1 | option2

The variable <variable_name> is <description_of_variable>. For example, to <do_something_specific>, type the following at the command prompt, and then press ENTER:

appcmd <exact_command_to_accomplish_the_procedure>


When you use Appcmd.exe to configure the <element_name> element at the global level in IIS 7, you must specify /commit:WEBROOT in the command so that configuration changes are made to the root Web.config file instead of ApplicationHost.config.

For more information about Appcmd.exe, see Appcmd.exe (IIS 7).


The procedure in this topic affects the following configuration elements:


For more information about IISĀ 7 configuration, see IIS 7.0: IIS Settings Schema on MSDN.

See Also


View a List of Output Caching Rules (IIS 7)
Add an Output Caching Rule (IIS 7)
Configure an Output Caching Rule Using Headers (IIS 7)