ASP.NET MVC 3.0, IIS 7, .NET 4
I have an action that returns data that seldom changes (almost static).
Is there an easy way to:
- return 304 "Not Modified" from action;
- include "Last-Modified" time stamp in the response.
I use return Content('my data');
for action result.
Basically I want an easy way to do what is talked about in this article : http://weblogs.asp.net/jeff/archive/2009/07/01/304-your-images-from-a-database.aspx
Whats wrong with this for 304?
and this for LastModified:
Or maybe just create a 'Not Modified' Filter.
(Very!) late answer but this question pops up near the top in search engine results so it might be useful to future people landing here.
Alternative for part 1:
use the material provided, you can build a small utility function in your controller
then use it like this: