page refrehing after a time limit and incrementing a value
I have an asp.net web application in c# script.
I want this application page to refreh after every 30 seconds or 60 minutes of time.
I have written my codes in its page_load event.
http://localhost:1096/DisplayPop3Email.aspx?emailId=97
this is my url to refresh every 30 or 60 seconds.
also i want to change or increment the value of email with that
ie;
http://localhost:1096/DisplayPop3Email.aspx?emailId=98
http://localhost:1096/DisplayPop3Email.aspx?emailId=99
like that.
how can i do this.
my real task is to make this automatic.
how can i do this???
does anyone have an idea, plea开发者_JS百科se share it with me.....
Thanks
Actually, I would use a META tag for this.
<meta http-equiv="refresh" content="30;http://localhost:1096/DisplayPop3Email.aspx?emailId=97">
this is the logic I'd have in the page load
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);
Notice that I'm doing the following things:
Using a META tag rather than a JS timer. This means that this will work regardless of browser/device.
I'm building my META tag in my code. This means that I can impact it every time (say I want to change every 30 seconds instead of 60 based on the counter)
Start a timer on the page and when it counts down, you just refresh the page passing the new emailid parameter.
精彩评论