Search code examples
asp.netpartial-page-refresh

asp.net - Force page refresh


I have a countdown on an auction site, that resets to 2 minutes when someone places a bid within the last two minutes of the auction. This part works as it should. What I need, is to reload the page when someone hits the bid-button, so that someone else wathing the counter, sees the counter reset, without hitting F5.

I've tried different things, like a meta tag that refreshes the page, javascript functions with counters, etc...

However, if someone needs to see the counter refresh immediately after a bid has been placed, the page needs to be refreshed every second, and that sucks...

So, I figured, if it is possible to have the page reload at a given interval using ex. a meta tag, would it be possible to do the same only when some event is fired?

Anyone with some tricks up their sleeves?

Thnx


Solution

  • If you are concerned with the frequency with which you will be generating server requests using a polling model, then you could perhaps look into a Comet (a.k.a. Reverse Ajax, Ajax push) based solution.

    http://en.wikipedia.org/wiki/Comet_%28programming%29

    Simply explained you rely on an implementation where you fire a single DoYouHaveAnUpdateEvent request from the page to the server and simply avoid responding to the request until there is actually an UpdateEvent. Upon receiving the UpdateEvent response, the page issues a new DoYouHaveAnUpdateEvent request