473,394 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Will Response.Redirect() stop a thread?

I have an aspx web page with the following C# code in the page load event.
Can somebody tell me if the Response.Redirect() will cause my tLoadDNN
thread to stop executing before it is finished? tLoadDNN might occasionally
take up to 16 seconds to complete.

protected void Page_Load(object sender, EventArgs e)
{
Thread tLoadDNN = new Thread(new ThreadStart(LoadDNN));
tLoadDNN.Start();
Response.Redirect("Default1.htm");
}
Jul 2 '06 #1
3 3038
The default behavior of Response.Redirect is to abort the thread.
If you don't want this to happen you can pass False to Response.Redirect's
optional second parameter.
Response.Redirect("SomePage.aspx", false);

Here's more info:
http://windowssdk.msdn.microsoft.com.../a8wa7sdt.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Mark Huebner" <ma**@IntelligentSoftwareSystems.comwrote in message
news:eW**************@TK2MSFTNGP03.phx.gbl...
>I have an aspx web page with the following C# code in the page load event.
Can somebody tell me if the Response.Redirect() will cause my tLoadDNN
thread to stop executing before it is finished? tLoadDNN might
occasionally take up to 16 seconds to complete.

protected void Page_Load(object sender, EventArgs e)
{
Thread tLoadDNN = new Thread(new ThreadStart(LoadDNN));
tLoadDNN.Start();
Response.Redirect("Default1.htm");
}

Jul 2 '06 #2
If the second parameter is "false", does that mean the Response.Redirect
won't redirect to the new URL until the thread finishes executing? I would
like it to redirect immediately to the new URL while the thread continues to
execute.

"Steve C. Orr [MVP, MCSD]" <St***@Orr.netwrote in message
news:ul**************@TK2MSFTNGP04.phx.gbl...
The default behavior of Response.Redirect is to abort the thread.
If you don't want this to happen you can pass False to Response.Redirect's
optional second parameter.
Response.Redirect("SomePage.aspx", false);

Here's more info:
http://windowssdk.msdn.microsoft.com.../a8wa7sdt.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Mark Huebner" <ma**@IntelligentSoftwareSystems.comwrote in message
news:eW**************@TK2MSFTNGP03.phx.gbl...
>>I have an aspx web page with the following C# code in the page load event.
Can somebody tell me if the Response.Redirect() will cause my tLoadDNN
thread to stop executing before it is finished? tLoadDNN might
occasionally take up to 16 seconds to complete.

protected void Page_Load(object sender, EventArgs e)
{
Thread tLoadDNN = new Thread(new ThreadStart(LoadDNN));
tLoadDNN.Start();
Response.Redirect("Default1.htm");
}


Jul 3 '06 #3
"Mark Huebner" <ma**@IntelligentSoftwareSystems.comwrote in message
news:OM*************@TK2MSFTNGP04.phx.gbl...
If the second parameter is "false", does that mean the Response.Redirect
won't redirect to the new URL until the thread finishes executing?
Yes.
I would like it to redirect immediately to the new URL
Response.Redirect("somepage.aspx", false);
return;
Jul 3 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Peter Kirk | last post by:
Hi there I have a program written by another company (it's a "web control" which returns a web-page: can I compare this to a servlet in the Java world?), which they think is causing problems on...
1
by: VB Programmer | last post by:
I have a default.aspx page that simply does this (in the "Try" block): Response.Redirect("MyStartPage.aspx") I keep getting this exception on this line: "System.Threading.ThreadAbortException:...
10
by: Niggy | last post by:
I get an error - any help appreciated. System.Threading.ThreadAbortException: Thread was being aborted. at System.Threading.Thread.AbortInternal() at System.Threading.Thread.Abort(Object...
4
by: Vi | last post by:
Hi, I have an <asp:Button> control on a page. When it is clicked, I run a db stored procedure and then I want to go to the next page by executing a Response.Redirect("NextPage.aspx?id=" + myID)....
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.