2009-12-12 36 views
0

我在c#脚本中有一个asp.net web应用程序。时间限制和增加值后页面刷新

我希望这个应用程序页面在每30秒或60分钟的时间之后刷新。

我已将自己的代码写入其page_load事件中。

http://localhost:1096/DisplayPop3Email.aspx?emailId=97

这是我的网址刷新每30或60秒。

我也想改变或增加电子邮件的价值

ie;

http://localhost:1096/DisplayPop3Email.aspx?emailId=98

http://localhost:1096/DisplayPop3Email.aspx?emailId=99

这样。

我该怎么做。

我真正的任务是使这个自动化。

我该怎么做?

没有任何人有一个想法,请与我分享吧.....

感谢

回答

0

其实,我会为此使用META标签。

<meta http-equiv="refresh" content="30;http://localhost:1096/DisplayPop3Email.aspx?emailId=97"> 

这是我不得不在页面加载

int email = 0 
if !(RequestQueryString("EmailID") = null) 
    email = (int)request.querystring("EmailID") +1 

HtmlMeta meta = new HtmlMeta(); 
meta.Name = "refresh"; 
meta.Content = "30; http://localhost:1096/DisplayPop3Email.aspx?emailId=" + email; 
this.Header.Controls.Add(meta); 

请注意,我做以下事情的逻辑:

使用META标签,而不是JS计时器。这意味着无论浏览器/设备如何,这都可以工作。

我在我的代码中构建了我的META标记。这意味着我可以每次影响它(例如,我想根据计数器每30秒更换一次而不是60次)

0

开始在页面上,当倒计时,你只刷新传递新的EMAILID页面计时器参数。