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

像那样。

我怎样才能做到这一点。

我真正的任务是让它自动化。

我怎样才能做到这一点???

有没有人有想法,请分享给我......

谢谢

4

2 回答 2

0

在页面上启动一个计时器,当它倒计时时,您只需刷新页面并传递新的 emailid 参数。

于 2009-12-12T06:21:03.683 回答
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 秒更改一次)

于 2009-12-12T06:50:30.693 回答