is there a way to disable server caching globally in ASP.NET? Like by adding some sort of setting to the web.config file?
So far I've tried adding these and it didnt make a difference...
<caching>
<sqlCacheDependency enabled="false"></sqlCacheDependency>
<outputCache enableOutputCache="false"
enableFragmentCache="false"
sendCacheControlHeader="false"
omitVaryStar="false" />
</caching>
According to MSDN:
e.g.
So your configuration is not working because you have the
enableOutputCache
attribute on theoutputCache
element, when it should be on theoutputCacheSettings
element.There is also a way of disabling this in system.webServer if you are using IIS7/7.5 or IIS Express. This will work in your main web.config file (for both webforms and mvc) and also in web.config files in subfolders, to disable it for particular areas of your application.
you can disable output caching and session state for the entire application by removing its modules , this can be done from web.config
or
add this to your page load
The OutputCacheSection section is used to configure application-scope settings, such as whether page output caching is enabled or disabled. For example, you can disable page output caching for the entire application by adding
enableOutputCache="false"
to the OutputCacheSection in yourWeb.config
file. Settings in the configuration file take precedence over cache settings in individual pages, so the example setting means that output cache will not be used.