As you may know we have got a new ActionResult called FileResult in RC1 version of ASP.NET MVC.
Using that, your action methods can ret
In newer versions of MVC you'd be better off returning an HttpStatusCodeResult. That way you don't need to set the Response.StatusCode or mess with anything else.
public ActionResult DisplayPhoto(int id)
{
//Your code to check your cache and get the image goes here
//...
if (isChanged)
{
return File(photo.Content, photo.ContentType);
}
return new HttpStatusCodeResult(HttpStatusCode.NotModified);
}