Refreshing a web page before redirecting to a new web page

I am working on a sign up form for my users. Once their data has been successfully added to the database I want to display a message and then redirect them to the main home page after 5 seconds. When I run the code, I never see my Successful message go to my textbox. Any ideas? Code is below:


1                lblInformation.Text = "Email Address Added Successfully! Please Wait..."
2                lblInformation.BackColor = Drawing.Color.Green
3                lblInformation.ForeColor = Drawing.Color.White
4                lblInformation.Font.Bold = True
5                System.Threading.Thread.Sleep(5000)
6                Response.Redirect("~/track/index.aspx", False)
9/19/2008 10:26:47 PM 93655 articles. 6 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 47

What is happening is Thread.Sleep puts the current thread to sleep for 5 seconds, now if you launched another thread let your current, main thread finish, and the put you new one to sleep for 5 seconds. You could in theory have that thread redirect you to another page. However you will run into thread abort issues as the spawned thread will never really have an abort or stop method.

You could register a start up script that redirects you after five seconds in javascript.

Js File

function redirect()
     window.location.href="/track/index/aspx" mce_href="/track/index/aspx";

Code Behind {C#}


public void SetRedirect()
        StringBuilder sb = new StringBuilder();
        sb.Append("\r\n<script language='JavaScript'>\r\n");
        sb.Append("function doTimeout()\r\n");
        sb.Append("window.onload = doTimeout;\r\n");
        sb.Append("// -->\r\n");
        control.Page.RegisterClientScriptBlock("SetRedirect", sb.ToString());
Please mark post as answer - Progressive Web Methodologies

My Blog
9/19/2008 10:36:22 PM

you could use update panel with update progress message saying "Successful"

then on the Submit Button click event just use the Thread.Sleep & Redirect.

That will ensure that the message shows while the sleep is occuring.

9/20/2008 5:57:06 AM

Similar Artilces:

Can my web page with a form submit to other web pages forms?
I was wondering if I created an aspx page that had a form on it that I could use the submit button to submit this form's contents to other web pages forms(servers accepting those form's data). I am thinking this would be a great way to update data on particular web pages without having to actually visit those similar web pages. Any ideas, examples would be much appreciated. Thanks in advance.  Yes you can.  It's called Cross Page Posting: might ...

want to allow create new web page and edit exiting web page using my web application?
 I am using 2.0 VS 2005 pro edition. I want to make web application(web form)  where my uses can go and create simple web page or can create page , so then can add page/edit features let me know if some one know , how to do this , any idea, I want to allow my user to create web page and edit web page using my web applications. some one tell me how to do that Note : I dont want to use HTMl editor or any third party software tools thank you maxmax Hello, There is many ways you can implement this. And to build your application you to need to understand the exact ou...

activating new web page from another web page
Hello all. I'm trying to activate a web from from another web form. I meen, something like: public class RptReq : System.Web.UI.Page { private void Page_Load(object sender, System.EventArgs e) { // Put user code to iniialize the page here Report rpt = new Report(); rpt.Page_Load(sender,e); } //Web Form Designer generated code } Report is another class in my name space. Can I get the right way to do it? Best regards to all. Shlomi <p><a target="_blank" href="sdfdf.asp">rdfgfdg</a></p> ...

how to open a web page in form of a popup web page
Hello, I have two web pages, let say. Page A : With a Button on it. PAge B: with some info. Now I need to: When I click on the Button of page A.Page B must open in a pop up window.  I can do this but problem is this when I clicked on the button for first time it does not show me any thing and when I clicked on the button for second time then It shows me Page B .My code is as follow:  1 protected void Page_Load(object sender, EventArgs e) 2 { 3 if (!this.Page.IsPostBack) 4 { 5 6 } 7 else 8...

web web web
Name: bahadir Email: Product: Firefox 2 Beta 2 Summary: web web web Comments: web sayfası yapmak Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.8.1b2) Gecko/20060821 Firefox/2.0b2 ...

link a web page to another web page?
I have a web page with my banner and buttons for my site on it. I want to add this to all of my pages. Instead of copying a pasting that to every page. Is there a way i can link the pages to the banner page? Thanx use ascx?:) Or you could create a template page. That is: Create a page inherited from System.Web.UI.Page and place your banner and buttons in this and then have all your other pages inherit tis custom page instead of System.Web.UI.Page. ...

i web page referencing another web page
Can one web page reference a control on another web page? EX. a page is brought up with a number of textbox controls. Using a hyperlink one can pop up a nother page with the calendar control. Select a date from the calendar control and place the value back in the previous page. Can this be done and how? Use a Page.RegisterClientScriptBlock to open a window, with a javascript string like this: "<script language=Javascript>'my_url.aspx','window_name','left=100,top=100,width=200,height=500,toolbar=no,scrollbars=yes,resizable=yes');</script>" Then you can s...

parent web page --child web page
Dear Developers , how to get values child web page values to parent web page ? For the example , I have parent Employee Address. and child Page have employee personal address.. when i access the Parent page , there is no employee address means ..child page pop rises , after complete child page then only , i can access the parent page.. how to i do .. Thanking u raja Thanks,Regards,

All web pages hang on web server when one of the web pages calls a run away sql query
Hi: We have a Windows 2003 dedicated web server running the .NET Frameworks 1.0 and 2.0.  We have a SQL Server cluster running SQL Server 2000.  Unfortunately, we do not have a test environment.  I have 2 .NET web sites in production.  My coworker has a voting .NET web page using AJAX on the same server.  The coworker wrote a query that was not indexing properly and when the page fired the query...the cluster went to almost 100% utilization.  My two web pages would hang and show a blank white page on the default.aspx.  Neither of m...

how can you display another web site's web page in your web page without leaving your site
Can you display another web site's web page in your web page without leaving your site? I know you could use a frameset with .asp, but it looks like Visual Web Delevoper 2005 does not have any controls to setup a frameset. Any help, that would point me in the right direction would be great. Thanks Patrick     With screen scraping 4GuysFromRolla.Com: Screen Scrapes in ASP.NET,Teemu KeiskiFinland, EU Thank you. This information was a great help!!! Thanks again Patrick...

Could PB .NET Web Form POST security Information to others web page??
This is a multi-part message in MIME format. ------=_NextPart_000_00F9_01C9C4D5.8FB45C90 Content-Type: text/plain; charset="big5" Content-Transfer-Encoding: quoted-printable Hi,=20 Have anyone came across the requesion to POST security informations from = PB .NET web form web page to other web site?? I have tried many datys, Could any kind man give me some suggessions?? thanks & Best regards Leon ------=_NextPart_000_00F9_01C9C4D5.8FB45C90 Content-Type: text/html; charset="big5" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML P...

Encrypt web application/ web site (all web pages)
Hello, I want to encrypt (secure) the whole web site when it is deployed on a remote server. Is there a way in ASP.NET 2.0 / IIS / 3rd party tool to encrypt all web pages that will render it useless for a competitor if they get it?I did look up this forum and google and did not find anything (though I will keep looking). Please respond if you know anything about it. Thanks,vp Please click "Mark as Answer" if you think this post answers your question Yes and no.  First, you can't encrypt web pages.  Those are HTML and displayed in the client's brow...

how to navigate the url page in one web application page to another web application page
In my project one solution have 2 web apllications in one 1.webapplication1 2.webapplication2. in firt webapplication1 i created one aspx page like sample.axpx. in second webapplication2 i created one aspx page like sample2.aspx... in sample2.aspx page have hyperlinl. I need to navigate this hyperlink when i click it go to the sample.axpx. how can i write navigate url for me. ..thanks  As i understand u, you need Multi Project soltuionsee this link,

How to store in a web page dynamic data in a web Page ?
Hi,I have 1 ListBox containing :1 ~ MACHINE A ~ 0 ~ 23 ~ R2 ~ MACHINE B ~ 4 ~ 477 ~ R3 ~ MACHINE C ~ 2 ~ 78~ R4 ~ MACHINE D ~ 9 ~ 76~ TI should have :1 ~ MACHINE A2 ~ MACHINE B3 ~ MACHINE C4 ~ MACHINE DThis ListBox is populated by a DataBase => So the line numbers isn't known for advance.How to store in ASP.NET these values (0, 23, 4, ...) ? I need these values into the web page because I need them for JavaScrip functions. Do List like HiddenFields exist ?Thanks for your tips.David. i am bit confused by your question.. can you explain it once more"Mark as ...

Web resources about - Refreshing a web page before redirecting to a new web page -

Advertise - Redirecting - YouTube
Search Call us: 1-855-500-2756 Get started Overview Why it Works Success Stories Get Started Make Video Ads Resources This page has moved. Redirecting ...

Aboriginal funds need redirecting - report
Aboriginal funds need redirecting - report

Freedom of speech: Redirecting our society to a dangerous course
Freedom of speech: Redirecting our society to a dangerous course

Leaked Federal Government mental health report recommends redirecting $1 billion from acute hospital ...
A report commissioned by the Federal Government recommends redirecting money from acute hospital care to community-based mental health services. ...

Sona talked of redirecting voters to wrong polls, court hears in robocalls trial
Michael Sona was overheard talking about American-style campaign politics to redirect voters to the wrong polling stations in the 2011 federal ...

Unscrupulous website adverts again redirecting some users to App Store from Safari
... granting any kind of permission… In iOS 8 beta 2, Apple supposedly had remedied the issue: “Safari now blocks ads from automatically redirecting ...

Play Store May Be Redirecting Some Search Terms To The Predefined Categories
The user experience on Android is never standing still, which is no more evident than in the Play Store itself. It seems Google may be trying ...

Please wait — redirecting to new New Jersey News page...

Click here if you are not redirected

Redirecting Sunlight Into Dark Urban Alleys With Translucent Panels
... detailed in a paper published in the journal Energy Express , a supplement of The Optical Society’s open-access journal Optics Express . Redirecting ...

Resources last updated: 12/8/2015 12:47:42 AM