Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 16, 2011 08:38 AM by Zhongqing Tang - MSFT
Member
515 Points
1502 Posts
May 11, 2011 01:51 PM|LINK
Hi,
I want to Redirect Page after 10 seconds so I did this:
DateTime dt = DateTime.Now.AddSeconds(10); while (DateTime.Now < dt) { //------Do nothing-------- } Response.Redirect("Default.aspx"); } }
Now,
I want to put it after RecoverPassword get to Success and send the email with password.
Check RecoverPassword events didnt find something that runs after succes.
What to do?
Thanks..
Contributor
2693 Points
542 Posts
May 11, 2011 02:26 PM|LINK
Use thread.Sleep if you want to wait in C#.
but I guess you want to wait client side, so best to use javascript....
What you are doing now, is making the user wait 10 seconds extra before the page loads....
hope this helps
All-Star
35986 Points
6550 Posts
May 11, 2011 02:39 PM|LINK
interwanderer1 but I guess you want to wait client side, so best to use javascript....
Or simply use a meta REFRESH tag:
http://www.netmechanic.com/news/vol4/promo_no15.htm
May 11, 2011 06:10 PM|LINK
How to write it in JavaScript on Client Side?
2600 Points
484 Posts
May 11, 2011 06:47 PM|LINK
Perfect example for your scenario using Java Script .
http://www.pageresource.com/jscript/jredir.htm
May 11, 2011 07:27 PM|LINK
Thanks,
But in what event I should put it?
Cause I want it to redirect to other page after the page has load the succes message of the PasswordRecovery
Star
10513 Points
1354 Posts
May 16, 2011 08:38 AM|LINK
Hi b007,
b007 But in what event I should put it?
I assume that btn_Click is the last event before redirection. Here is the sample code:
protected void btn_Click(object sender, EventArgs e) { /* * * your code * */ string str = "<script type=\"text/javascript\">"; str += "function go() { this.location = \"http://www.asp.net/\";}"; str += "alert(\"You will be redirected to asp.net in 5s \");"; str += "setTimeout('go()', 5000);"; str += "</script>"; Response.Write(str); }
Hope this helps.
b007
Member
515 Points
1502 Posts
Redirect to a page after 10 seconds..
May 11, 2011 01:51 PM|LINK
Hi,
I want to Redirect Page after 10 seconds so I did this:
DateTime dt = DateTime.Now.AddSeconds(10); while (DateTime.Now < dt) { //------Do nothing-------- } Response.Redirect("Default.aspx"); } }Now,
I want to put it after RecoverPassword get to Success and send the email with password.
Check RecoverPassword events didnt find something that runs after succes.
What to do?
Thanks..
interwandere...
Contributor
2693 Points
542 Posts
Re: Redirect to a page after 10 seconds..
May 11, 2011 02:26 PM|LINK
Use thread.Sleep if you want to wait in C#.
but I guess you want to wait client side, so best to use javascript....
What you are doing now, is making the user wait 10 seconds extra before the page loads....
hope this helps
.one of my (older) projects social tomorrow and
hans_v
All-Star
35986 Points
6550 Posts
Re: Redirect to a page after 10 seconds..
May 11, 2011 02:39 PM|LINK
Or simply use a meta REFRESH tag:
http://www.netmechanic.com/news/vol4/promo_no15.htm
b007
Member
515 Points
1502 Posts
Re: Redirect to a page after 10 seconds..
May 11, 2011 06:10 PM|LINK
How to write it in JavaScript on Client Side?
Shellymn
Contributor
2600 Points
484 Posts
Re: Redirect to a page after 10 seconds..
May 11, 2011 06:47 PM|LINK
Perfect example for your scenario using Java Script .
http://www.pageresource.com/jscript/jredir.htm
b007
Member
515 Points
1502 Posts
Re: Redirect to a page after 10 seconds..
May 11, 2011 07:27 PM|LINK
Thanks,
But in what event I should put it?
Cause I want it to redirect to other page after the page has load the succes message of the PasswordRecovery
Zhongqing Ta...
Star
10513 Points
1354 Posts
Re: Redirect to a page after 10 seconds..
May 16, 2011 08:38 AM|LINK
Hi b007,
I assume that btn_Click is the last event before redirection. Here is the sample code:
protected void btn_Click(object sender, EventArgs e) { /* * * your code * */ string str = "<script type=\"text/javascript\">"; str += "function go() { this.location = \"http://www.asp.net/\";}"; str += "alert(\"You will be redirected to asp.net in 5s \");"; str += "setTimeout('go()', 5000);"; str += "</script>"; Response.Write(str); }Hope this helps.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework