I want to be able to set a long expires time for certain items that a user downloads via GET request.
I want to say 'this is good for 10 minutes' (i.e. I want to set an Expires header for +10 minutes). The requests are fragments of HTML that are being displayed in the page via AJAX and they're good for the user's session. I don't want to go back to the server and get a 304 if they need them again - I want the browser cache to instantly give me the same item.
I found an article which is almost a year old about MVC Action filter caching and compression. This creates a custom ActionFilter to change the expires header. I'm already using the compression filter which works great for some custom css I am generating (94% compression rate!).
I have two main concerns :
1) Do I really have to use this method. I'm fine with it if I do, but is there really no functionality in MVC or the OutputCache functionality to do this for me? In 'traditional' ASP.NET I've always just set the Expires header manually, but we cant do that anymore - at least not in the controller.
2) If I do use this filter method - is it going to interfere with the OutputCache policy at all - which I want to be able to control in web.config. I'm kind of thinking the two are mutually exclusive and you wouldn't want both - but I'm not completely sure.