Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Will Response.Redirect() stop a thread?

Reply
Thread Tools

Will Response.Redirect() stop a thread?

 
 
Mark Huebner
Guest
Posts: n/a
 
      07-02-2006
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");
}


 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      07-02-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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");
> }
>



 
Reply With Quote
 
 
 
 
Mark Huebner
Guest
Posts: n/a
 
      07-03-2006
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]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>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");
>> }
>>

>
>



 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      07-03-2006
"Mark Huebner" <(E-Mail Removed)> wrote in message
news:OMUga$(E-Mail Removed)...

> 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;


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to stop java service with command line parameter '-stop'? Will Java 1 11-02-2004 03:32 PM
f2.8 vs f3.7- Is it one stop or 2 stop difference zxcvar Digital Photography 12 05-20-2004 06:28 PM
How to stop a thread without using stop() Son KwonNam Java 11 04-09-2004 08:01 PM
Q. My browser doesn't stop, when I click on STOP. Jim Jones Computer Support 7 02-03-2004 09:47 PM
Stop Debugging doesn't stop in ASP.NET Matt Theule ASP .Net 7 07-24-2003 07:38 PM



Advertisments