ASP.NET MVC : how do I return 304 "Not Modified" status?

Posted by THX-1138 on Stack Overflow See other posts from Stack Overflow or by THX-1138
Published on 2011-04-27T20:14:46Z Indexed on 2012/09/20 21:38 UTC
Read the original article Hit count: 169

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:

  1. return 304 "Not Modified" from action;
  2. 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

© Stack Overflow or respective owner

Related posts about asp.net-mvc-3

Related posts about http-status-code-304