What happens to current thread execution after Response.Redirect???
Say I have the following code:
VB Code:
Dim dt As New DataTable
'code to populate datatable
If dt.Rows.Count = 0 Then
Response.Redirect("NoRecords.aspx")
End If
What happens to dt and the current thread execution?
Say I did:
VB Code:
If dt.Rows.Count = 0 Then
Response.Redirect("NoRecords.aspx")
Dim Woof As Integer = 67
End If
And place a break point on the Dim Woof line, then when u run the code it's clear that the Dim Woof line will NEVER get executed.
This goes against all other synchronous and asynchronous calls, which will always return...someone will now ocme up with an example to go against what I said, but you know what I mean.
So...what is actually happening here on the Redirect command?
Does it start a new thread? If so, what happens to the old one? Is it left to the GAC to clear up?
Woka
Re: What happens to current thread execution after Response.Redirect???
Everything on a page is 'destroyed' after the request is complete, even if there is no Response.Redirect. Therefore, moving to the next page or completing execution of the current one makes no difference in this context.
Re: What happens to current thread execution after Response.Redirect???
but what happens to thread execution, as normal functions would prosess the Response.Redirect, and then continue to the next line of code.
What happens to this? Does the thread get toasted instantly?
ie...if I have a connection open I shoudl do .close b4 I redirect blah blah blah.
U have to write code around teh fact that the redirect function termintes the currect code execution...
Woka
Re: What happens to current thread execution after Response.Redirect???
Does the GAC clean up the old page and it's objects then?
Woka
Re: What happens to current thread execution after Response.Redirect???
There is an overloaded method for Response.Redirect. You can specify whether to end the response on the current page -> http://msdn.microsoft.com/library/de...irectTopic.asp.
Maybe worth a try - never used it myself though.
DJ
Re: What happens to current thread execution after Response.Redirect???
Hmmmm very interesting. Damn, alredy given u a rep point, so can't give another. Doh!
So, now for the nitty gritty questions. What overloaded method should you use?
Woof
Re: What happens to current thread execution after Response.Redirect???
I would have thought:
Code:
Response.Redirect("http://www.somewhere.com/default.aspx", false);
But like I said never tried it!
DJ