George2
George2

Reputation: 45781

http meta refresh issue

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

Answers (4)

EricLaw
EricLaw

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

ajay_whiz
ajay_whiz

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

blparker
blparker

Reputation: 343

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.

Upvotes: 2

thedz
thedz

Reputation: 5572

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

Upvotes: 1

Related Questions