web analytics

How TO Disable ASP.NET Web Page Caching?

Options

codeling 1595 - 6639
@2015-12-30 18:47:34

There are two wasy to control the caching of Web pages in ASP.NET. You can use the @ OutputCache directive to control page output caching in ASP.NET, or you can control the cache programmatically through Response.Cache.SetCacheability method.

To turn off the output cache for an ASP.NET Web page at the client location and at the proxy location, set the Location attribute value to none, and then set the VaryByParam value to none in the @ OutputCache directive. Use the following code samples to turn off client and proxy caching.


Declarative Approach:

<%@ OutputCache Location="None" VaryByParam="None" %>


Programmatic Approach:

Response.Cache.SetCacheability
(HttpCacheability.NoCache);

Comments

You must Sign In to comment on this topic.


© 2024 Digcode.com