处理控制器的HTTP头和状态codeS [英] Handle HTTP-Headers and status codes in controller

查看:104
本文介绍了处理控制器的HTTP头和状态codeS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从具有一定间隔的数据库即时通讯目前调查数据。对于后端我使用C#和MVC2的框架。正如我在10秒的时间间隔获取数据,现在我想在我的控制器后端实现某种条件,将解析HTTP头,如果它没有被上次修改的获取不会再次获取数据。我真的不知道我怎么会去了解这一点。任何人有什么好的建议吗?!

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?!

问候

推荐答案

为什么要与HTTP标头为这个烂摊子身边?只需使用的OutputCache属性 - 这正是它是

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

这篇关于处理控制器的HTTP头和状态codeS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆