How to fix problems with Ajax Page Caching in asp.net mvc 4

by Steve French in ASP.net MVC, How To Fix on June 28, 2012

The Problem

'Error' photo (c) 2008, Nick Webb - license: https://creativecommons.org/licenses/by/2.0/You’re using the otherwise awesome ASP.net MVC 4 and you can use an ajax function once, via the @Ajax.ActionLink tool, but you try it again, and it does nothing.

The Cause

For whatever reason the browser thinks it is a cache page and pulls it from the cache – I’m not 100% sure of this.

The Solution

Just add a DateTime.Now as a parameter, this forces the browser to send the data every time.