The reason for the error is Response.Redirect method.
If you want to get rid of this exception, use Response.Redirect(url, false).
Instead of putting Response.Redirect into Try..Catch block. You may try this one:
Dim url As String
Try
url = Application("sRoot") & "Prva.aspx"
Catch ex As Exception
Dim Greska As String
Greska = ex.Message
Greska = ex.ToString()
url = Session("sRoot") & "GlobalError.aspx?ER=" & Greska
End Try
Response.Redirect(url, False)
Sorry I didnt used to
VB.Net, and some syntax error(s) may be occurred.
-----------------------------------------------
I'm going to write some about the situation; it may clarify your mind if you have some patience to read.
Your page is executing by a thread on which asp.net worker process contains. And on some line in your code, an instruction (Response.Redirect) wants to stop the execution because it must be stopped and asp.net framework must be notified about a redirection request.
Asp.net framework catches the Redirect method's exception, aborts the thread and use a new thread for execution of to be redirected page.
This occurs when you specify the second argument of Redirect method as True. Because this means to asp.net framework as 'Stop this page's execution ASAP and execute to be redirected page'.
...
Yesterday, I forgot to write down something about special exception class named ThreadAbortException.
You are getting this exception because Response.Redirect method internally calls Response.End method which raises this exception and the page processing terminates. Response.End raises this exception indirectly through calling Thread.Abort which raises this exception directly.
This exception is a special exception as I have said. The common language runtime has a special attention for this exception. When this exception occurs you can catch it in a catch block of a try...catch structure. And this exception will be raised again by the runtime at the end of the catch block. So, as you see, this is the reason why you are getting this exception even you were encapsulating Response.Redirect in a try...catch block.
Inanc Gumus
Software Architect
can be reached at
[email protected]