Is it possible to use ASP.NET push new content to browser automatically

  • Thread starter Thread starter Reid LI
  • Start date Start date
R

Reid LI

I just know I can do something in HTTP header like
<meta http-equiv="refresh" content="5">

but can ASP.NET push, for example, new database content to browser
automatically without using browser polling like the above.
 
I just know I can do something in HTTP header like
<meta http-equiv="refresh" content="5">

but can ASP.NET push, for example, new database content to browser
automatically without using browser polling like the above.

The server cannot communicate with the client directly and client has
to request the information.

Instead of refreshing a whole page you can consider JS/AJAX
 
Reid said:
I just know I can do something in HTTP header like
<meta http-equiv="refresh" content="5">

but can ASP.NET push, for example, new database content to browser
automatically without using browser polling like the above.

It's the HTTP protocol that sets the limitation. There is no way that
the server can push anything to the browser without the browser
requesting it first.

If you want to send data from the server to the browser, you need to put
a component in the browser that establishes a permanent connection
between the server and the browser.

This is of course a complicated solution just to update some data. You
can let the browser look for changes on the server without reloading the
page. A Javascript can use something like AJAX to contact the server,
and if there is any updated data, it can either fetch the data and put
it in the page, or just reload the page.
 
Back
Top