To work around this problem, use one of the following methods, as appropriate for your situation.
Method 1: Disable kernel mode caching
You can disable kernel mode caching systemwide, or you can disable kernel mode caching for a specific ASP.NET application. This method is the preferred workaround because you can still use output caching in the ASP.NET application. To disable kernel mode caching, follow these steps:
- If you want to disable kernel mode caching systemwide, open the Machine.config configuration file. This file is located in the following folder:
Drive:\WINDOWS\Microsoft .NET\Framework\Version\CONFIG
Note Drive is a placeholder for the drive where the operating system is installed. Version is a placeholder for the version number of the Microsoft .NET Framework that is installed.
If you want to disable kernel mode caching for a specific ASP.NET application, open the Web.config configuration file. This file is located in the ASP.NET application folder. - In the configuration file, locate the <httpRuntime> element, and then add the following attribute:
enableKernelOutputCache="false"
Method 2: Disable output caching in a specific ASP.NET page
You can disable output caching in the specific ASP.NET page that generates an HTTP header that contains a
Set-Cookie response. However, you must identify every ASP.NET page in the whole application that may generate a cookie. For example, if you are using cookies to maintain the session state, any page that a user accesses may generate a cookie.
To disable output caching in a specific ASP.NET page, delete the
<%@ OutputCache %> directive from any .aspx file that you do not want to be cached. For more information about the
<%@ OutputCache %> directive in ASP.NET pages, visit the following Microsoft Developer Network (MSDN) Web site: