How to disable automatic browser caching from asp.Net mvc application?
Because I am having a problem with caching as it caches all links. But sometimes it redirected to DEFAULT INDEX PAGE automatically
which stored it caching and then all the time I click to that link it will redirect me to DEFAULT INDEX PAGE.
So some one know how to manually disable caching option from ASP.NET MVC 4?
You can use the
OutputCacheAttributeto control server and/or browser caching for specific actions or all actions in a controller.Disable for all actions in a controller
Disable for a specific action:
If you want to apply a default caching strategy to all actions in all controllers, you can add a global action filter by editing your
global.asax.csand looking for theRegisterGlobalFiltersmethod. This method is added in the default MVC application project template.This will cause it to apply the
OutputCacheAttributespecified above to every action, which will disable server and browser caching. You should still be able to override this no-cache by addingOutputCacheAttributeto specific actions and controllers.