FIX: Client-side caching does not occur when you use the OutputCache directive with the VaryByParam attribute (836868)



The information in this article applies to:

  • Microsoft .NET Framework 1.1
  • Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2003), Academic Edition
  • Microsoft ASP.NET (included with the .NET Framework 1.1)

SUMMARY

This article discusses the problem of client browsers not caching the response when you use the VaryByParam attribute or the VaryByCustom attribute of the Output directive, and you set their values to the asterisk (*) character. This article also discusses how to obtain a software update that resolves this problem and how the software update works.

SYMPTOMS

When you use the OutputCache directive with the value of the VaryByParam attribute set to the asterisk (*) character, client browsers do not cache the response. For example, you may see this behavior when you use the following directive:

<%@ OutputCache Duration="100" VaryByParam="*" %>

This behavior may also occur when one or both of the following conditions are true:
  • The cacheability of the Cache object is set to ServerAndPrivate.
  • You use the VaryByCustom attribute of the OutputCache directive.

CAUSE

When you use the VaryByParam attribute or the VaryByCustom attribute of the Output directive, and you set their values to be equal to the asterisk character, the browser is sent the following header:

Vary: *

This header is sent because the response may vary by something other than the parameters. A client such as Microsoft Internet Explorer receives this header, but the client does not cache the response.

Also, the Cache object can be set programmatically. For example, you can set the Cache object by using the following code:
 Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate)
Because the client does not cache the response, the ServerAndPrivate cacheability behaves as if it is set to Server.

For more information about how to set cacheability programmatically, see the "References" section.

RESOLUTION

Software update information

A supported software update is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This software update may receive additional testing. Therefore, if you are not severely affected by this problem, Microsoft recommends that you wait for the next Microsoft .NET Framework 1.1 service pack that contains this software update.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the software update. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Prerequisites

No prerequisites are required.

Restart requirement

You may have to restart your computer if any services or applications are running that use files that are listed in the "File Information" section.

Software update replacement information

This software update does not replace any other software updates.

File information

The English version of this software update has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
   Date         Time   Version        Size       File name
   ----------------------------------------------------------------------------------------------
   21-Apr-2004  05:06  1.1.4322.1033    258,048  Aspnet_isapi.dll
   21-Apr-2004  05:06  1.1.4322.1033     20,480  Aspnet_regiis.exe
   21-Apr-2004  05:06  1.1.4322.1033     32,768  Aspnet_state.exe
   21-Apr-2004  05:06  1.1.4322.1033     32,768  Aspnet_wp.exe
   05-Apr-2004  21:39                    33,718  Installpersistsqlstate.sql
   05-Apr-2004  21:39                    34,342  Installsqlstate.sql
   05-Apr-2004  21:39                    35,243  Installsqlstatetemplate.sql
   21-Apr-2004  04:57  1.1.4322.1033     94,208  Perfcounter.dll
   21-Apr-2004  05:01                     8,685  Smartnav.js
   22-Apr-2004  00:53  1.1.4322.1033  1,220,608  System.dll
   22-Apr-2004  00:53  1.1.4322.1033    241,664  System.messaging.dll
   22-Apr-2004  00:53  1.1.4322.1033    323,584  System.runtime.remoting.dll
   22-Apr-2004  00:53  1.1.4322.1033    131,072  System.runtime.serialization.formatters.soap.dll
   22-Apr-2004  00:53  1.1.4322.1033  1,257,472  System.web.dll
   22-Apr-2004  00:53  1.1.4322.1033    819,200  System.web.mobile.dll
   22-Apr-2004  00:53  1.1.4322.1033    569,344  System.web.services.dll
   22-Apr-2004  00:53  1.1.4322.1033  1,339,392  System.xml.dll
   03-Oct-2003  20:20                     2,119  Uninstallsqlstatetemplate.sql
   21-Apr-2004  05:01                    14,482  Webuivalidation.js

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

The Response.Cache.SetOmitVaryStar("true") method has been added to the Response.Cache object. The Response.Cache.SetOmitVaryStar("true") method overrides the default behavior of the Cache object. Because of this method, the client can cache the response when you use the OutputCache directive and you set the value of the VaryByParam attribute or the VaryByCustom attribute to the asterisk character.

Note If you pass a parameter value of "false" to the SetOmitVaryStar method, and you use the OutputCache directives, client caching behaves as it did before you applied this software update.

With ASP.NET, you can cache the whole response content for dynamic pages on HTTP 1.1-capable mechanisms, including browsers, proxy servers, and the Web server where your application resides. You can enable caching by including the @ OutputCache directive in the .aspx file for the page. For example, include the following:

<%@ OutputCache Duration="60" VaryByParam="None" %>

When you use the @ OutputCache directive, the Duration attribute and the VaryByParam attribute are required. The required VaryByParam attribute lets you vary the cached output depending on the GET query string or depending on the form POST parameters.

For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates

REFERENCES

For additional information about the Component Checker tool and about caching, click the following article numbers to view the articles in the Microsoft Knowledge Base:

307255 Component Checker: Diagnose problems and reconfigure MDAC installations

323290 How to cache in ASP.NET by using Visual C# .NET

811431 How to cache in ASP.NET by using Visual Basic .NET

For more information about how to set cacheability programmatically, visit the following Microsoft Developer Network (MSDN) Web sites:

Modification Type:MajorLast Reviewed:4/7/2006
Keywords:kbQFE KBHotfixServer kbNetFrame110preSP1fix kbHttpRuntime kbfix kbcode kbBug KB836868 kbAudDeveloper