1

my page is using sqlcachedependency. so the page read information from cache until data in database is changed but i need the page was auto refresh when data is changed. How can i do that?

Mahdi_Nine
  • 14,205
  • 26
  • 82
  • 117

1 Answers1

1

The problem you have is that the Server knows the data has changed but that there is no active communication with the client until the user hits a button in his browser.

A solution for this could be to write some javascript that would ask the server every X seconds if there are changes. If you want to implement something like this you need to look at AJAX and the Periodic Refresh pattern.

Or you could have a look at the new WebSockets that's being implemented in HTML5 which allows bidirectional communication between client and server.

Wouter de Kort
  • 39,090
  • 12
  • 84
  • 103
  • thanks.i want to use from timer in ajax but it checked cache every const second.if it's request from cache doesn't decrease the performance of sever? – Mahdi_Nine Nov 04 '11 at 10:37
  • Checking every second if there is new data will decrease the performance. You will need to find a delay so bot you're performance and the data integrity are in a reasonable range. – Wouter de Kort Nov 04 '11 at 10:44