How to refresh page using c# in every five minutes in ASP.NET
?
如何在ASP.NET中每五分钟使用c#刷新一次页面?
5 个解决方案
#1
2
Using the following HTML meta tag in your header <META HTTP-EQUIV="REFRESH" CONTENT="300">
should do the trick
在标题中使用以下HTML元标记 应该做的伎俩
#2
5
One is Javascript:
一个是Javascript:
setTimeout("location.reload(true);", timeout);
The second is a Meta tag:
第二个是Meta标签:
<meta http-equiv="refresh" content="300">
#3
2
You can't force an HTML page to refresh from the server side. The client must request the page.
您无法强制从服务器端刷新HTML页面。客户端必须请求该页面。
The only ways to do this always involve either using the META refresh tag, the Refresh HTTP header, or else javascript which forces a page reload on an interval.
执行此操作的唯一方法始终涉及使用META刷新标记,刷新HTTP标头或其他强制页面重新加载的javascript。
Any "server-side" solution will do it by either writing javascript or the META tag to the page. There's simply no other way to do it.
任何“服务器端”解决方案都可以通过将javascript或META标记写入页面来实现。根本没有办法做到这一点。
#4
0
the simplest way is
最简单的方法是
<Head>
<meta equiv="refresh" content="5">
</Head>
or use timer control to refresh a webpage for every five minutes for example: drag and drop timer control in form.aspx and in form load add the code like below
或使用计时器控制每五分钟刷新一次网页,例如:在form.aspx中拖放计时器控件,在表单加载中添加如下代码
<asp:Timer ID="Timer1" runat="server" Interval="6000" ontick="Timer1_Tick" />
form load
public void DoMagic()
{
}
protected void Timer1_Tick(object sender, EventArgs e)
{
DoMagic();
Label1.Text = "";
}
#5
0
window.setInterval(function () {
// this will execute every 1 second
methodCallOrAction();
}, 1000);
function methodCallOrAction()
{
// u can call an url or do something here
}
#1
2
Using the following HTML meta tag in your header <META HTTP-EQUIV="REFRESH" CONTENT="300">
should do the trick
在标题中使用以下HTML元标记 应该做的伎俩
#2
5
One is Javascript:
一个是Javascript:
setTimeout("location.reload(true);", timeout);
The second is a Meta tag:
第二个是Meta标签:
<meta http-equiv="refresh" content="300">
#3
2
You can't force an HTML page to refresh from the server side. The client must request the page.
您无法强制从服务器端刷新HTML页面。客户端必须请求该页面。
The only ways to do this always involve either using the META refresh tag, the Refresh HTTP header, or else javascript which forces a page reload on an interval.
执行此操作的唯一方法始终涉及使用META刷新标记,刷新HTTP标头或其他强制页面重新加载的javascript。
Any "server-side" solution will do it by either writing javascript or the META tag to the page. There's simply no other way to do it.
任何“服务器端”解决方案都可以通过将javascript或META标记写入页面来实现。根本没有办法做到这一点。
#4
0
the simplest way is
最简单的方法是
<Head>
<meta equiv="refresh" content="5">
</Head>
or use timer control to refresh a webpage for every five minutes for example: drag and drop timer control in form.aspx and in form load add the code like below
或使用计时器控制每五分钟刷新一次网页,例如:在form.aspx中拖放计时器控件,在表单加载中添加如下代码
<asp:Timer ID="Timer1" runat="server" Interval="6000" ontick="Timer1_Tick" />
form load
public void DoMagic()
{
}
protected void Timer1_Tick(object sender, EventArgs e)
{
DoMagic();
Label1.Text = "";
}
#5
0
window.setInterval(function () {
// this will execute every 1 second
methodCallOrAction();
}, 1000);
function methodCallOrAction()
{
// u can call an url or do something here
}