Internet Explorer Caching asp.netmvc ajax results

Diego Correa picture Diego Correa · Apr 16, 2010 · Viewed 13.2k times · Source

I'm having an issue with a page in internet explorer. I have an ajax call that calls a form, in other browser, when I click the link it passes in the controller and load correctly data. but in IE, when its loaded once, it aways brings me the same old results without passing in the controller.

Answer

LukLed picture LukLed · Apr 16, 2010

Try:

[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]

This attribute, placed in controller class, disables caching. Since I don't need caching in my application, I placed it in my BaseController class:

[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
public abstract class BaseController : Controller
{

Here is nice description about OutputCacheAttribute: Improving Performance with Output Caching

You can place it on action too.