1

Im currently polling data with from an Database with an regular interval. For the backend I'm using C# and MVC2 as framework. As I'm fetching data with an interval of 10 seconds now I would like to in the backend in my controller implement some kind of conditional that will parse the http header and not fetch the data again if it has not been modified since last fetch. I'm not really sure how I would go about with this. Anyone have any good suggestions?!

Regards

Tim
  • 531
  • 2
  • 7
  • 25
  • There seem to be some kind of technical problem with this question. I got an answer from user @Darin, and I commented on it. Though on refreshing it "vanished". Anyone got any suggestion on my question? Basically what I woul like to do is something like mentioned in this article: http://blogs.clariusconsulting.net/kzu/setting-http-headers-in-net-this-header-must-be-modified-using-the-appropriate-property/ – Tim May 10 '11 at 07:26

1 Answers1

0

Why mess around with http headers for this? Just use the OutputCache attribute - this is exactly what it's for.

UpTheCreek
  • 31,444
  • 34
  • 152
  • 221
  • That could be it:). So how do the OutputCache attribute work then? What I'm doing now, or trying to do in my public ActionResult is this: var ifModifiedSince = Request.Headers["If-Modified-Since"]; if( ifModifiedSince == 304) and then if I it hasnt been modified since last fetch I return an 304 otherwise I just return the View("Index"); – Tim May 10 '11 at 12:03