E
Eric
I have the following situation: I was getting intermittent errors using
Reponse.Redirct("url", true) and was trying to catch the
ThreadAbortException, but it was not staying caught and was showing up again
where my code wasnt expecting it. I'm not sure what was causing it. The
catch block in RedirectPage is supposed to quash the ThreadAbortException
but it not only shows up there, but also in the outer catch block will catch
it as well. It should not show up in both places.
For example
try 'Outer
'Do stuff
'want to catch an exception on a specific action
try
Throw new Exception("test")
catch ex as Exception
RedirectPage("Error.aspx")
End Try
catch tex as TreadAbortException
'This should never fire as the RedirectPage function catches it. But
it's showing up after the RedirectPage catches a ThreadAbortException
already
catch ex as exception
'should be only something not handled previously.
End Try
Public sub RedirectPage(url as string)
Dim strMsg As String
Try
Response.Redirect(url, TRUE)
Catch tex As Threading.ThreadAbortException ' this is SUPPOSED to
catch the threadAbort if true is passed in, but it doesnt always
strMsg = tex.Message
Catch ex As Exception
strMsg = ex.Message
End Try
End Sub
Reponse.Redirct("url", true) and was trying to catch the
ThreadAbortException, but it was not staying caught and was showing up again
where my code wasnt expecting it. I'm not sure what was causing it. The
catch block in RedirectPage is supposed to quash the ThreadAbortException
but it not only shows up there, but also in the outer catch block will catch
it as well. It should not show up in both places.
For example
try 'Outer
'Do stuff
'want to catch an exception on a specific action
try
Throw new Exception("test")
catch ex as Exception
RedirectPage("Error.aspx")
End Try
catch tex as TreadAbortException
'This should never fire as the RedirectPage function catches it. But
it's showing up after the RedirectPage catches a ThreadAbortException
already
catch ex as exception
'should be only something not handled previously.
End Try
Public sub RedirectPage(url as string)
Dim strMsg As String
Try
Response.Redirect(url, TRUE)
Catch tex As Threading.ThreadAbortException ' this is SUPPOSED to
catch the threadAbort if true is passed in, but it doesnt always
strMsg = tex.Message
Catch ex As Exception
strMsg = ex.Message
End Try
End Sub