How to refresh a page using C # int every five minutes?

How to refresh a page using C # every five minutes in ASP.NET ?

+6
source share
5 answers

Using the following HTML meta tag in the <META HTTP-EQUIV="REFRESH" CONTENT="300"> header should do the trick

+2
source

One of them is Javascript:

 setTimeout("location.reload(true);", timeout); 

The second is the meta tag:

 <meta http-equiv="refresh" content="300"> 
+5
source

You cannot force the HTML page to be updated from the server side. Customer must request a page.

The only ways to do this are always by using either the META update tag, the Refresh HTTP header, or javascript, which forces the page to reload at intervals.

Any server-side solution will do this either by writing javascript or the META tag on the page. There is simply no other way to do this.

+2
source

The easiest way:

 <Head> <meta equiv="refresh" content="5"> </Head> 

or use a timer to refresh a web page every five minutes, for example: control the drag and drop timer in form.aspx and in the form load add the code as shown below

 <asp:Timer ID="Timer1" runat="server" Interval="6000" ontick="Timer1_Tick" /> 

Form loading

 public void DoMagic() { } protected void Timer1_Tick(object sender, EventArgs e) { DoMagic(); Label1.Text = ""; } 
0
source
  window.setInterval(function () { // this will execute every 1 second methodCallOrAction(); }, 1000); function methodCallOrAction() { // u can call an url or do something here } 
0
source

Source: https://habr.com/ru/post/924244/


All Articles