Reputation: 45781
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?
Upvotes: 1
Views: 754
Reputation: 57085
You shouldn't use META Refresh. If you want to reload the page, use the JavaScript method window.location.reload(false);
I explain why here: http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/meta-refresh-causes-additional-http-requests.aspx and http://blogs.msdn.com/b/ieinternals/archive/2010/07/08/technical-information-about-conditional-http-requests-and-the-refresh-button.aspx
Upvotes: 0
Reputation: 17931
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
Upvotes: 0