http meta refresh issue

2019-05-30 11:17发布

I am using http meta refresh to reflesh current page to keep session live. I am using VSTS 2008 + C# + .Net 3.5 and developing ASP.Net application.

My question is, is it possible to send from client (browser) side If-Not-Modified-Since request header to server side and check if at server side responses 304 Not-Modified header to client? (I want to use this to optmize bandwidth and overhead at server.)

If yes, could anyone recommend me some sample code at client side and at server side how to implement this?

4条回答
爷、活的狠高调
3楼-- · 2019-05-30 11:21

You can use jQuery's Ajax api see the documentation here, there is a ifModified param. Moreover, the use of HTTP Meta Refresh is discouraged by W3C

查看更多
你好瞎i
4楼-- · 2019-05-30 11:35

I'm not super familiar with ASP.NET, but in general, for something like this, consider using ETags.

查看更多
疯言疯语
5楼-- · 2019-05-30 11:42

This could potentially be addressed with the HtmlMeta class that was added in .NET 2.0. It allows programmatic access to the meta keywords. You can check it out here.

查看更多
登录 后发表回答