Server.Transfer exception

J

Jan

Hi,

If I put a try catch block for Server.Transfer call. It will catch a
System.Threading.ThreadAbortException exception like this. However, it
transfer the page to the correct page. Why did this exception occur?

Thanks.
------------------------------------
{"Thread was being aborted." }

[System.Threading.ThreadAbortException]:
{System.Threading.ThreadAbortException}

System.Object: {System.Threading.ThreadAbortException}

_COMPlusExceptionCode: -532459699

_className: "System.Threading.ThreadAbortException"

_exceptionMethod: {System.Reflection.RuntimeMethodInfo}

_exceptionMethodString: null

_message: "Thread was being aborted."

_innerException: null

_helpURL: null

_stackTrace: {System.Array}

_stackTraceString: " at System.Threading.Thread.AbortInternal()

at System.Threading.Thread.Abort(Object stateInfo)

at System.Web.HttpResponse.End()

at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm)

at System.Web.HttpServerUtility.Transfer(String path)

at TestASPNET.Form1.btnTransfer_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\testaspnet\form1.aspx.cs:line 182"

_remoteStackTraceString: null

_remoteStackIndex: 0

_HResult: -2146233040

_source: "mscorlib"

_xptrs: 0

_xcode: -532459699

Message: "Thread was being aborted."

InnerException: null

TargetSite: {System.Reflection.RuntimeMethodInfo}

StackTrace: " at System.Threading.Thread.AbortInternal()

at System.Threading.Thread.Abort(Object stateInfo)

at System.Web.HttpResponse.End()

at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm)

at System.Web.HttpServerUtility.Transfer(String path)

at TestASPNET.Form1.btnTransfer_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\testaspnet\form1.aspx.cs:line 182"

HelpLink: ""

Source: "mscorlib"

HResult: -2146233040
 
J

Jan

Thanks for the info. But what is the purpose of raising this exception?
Tammy said:
from the MSDN site:
http://msdn.microsoft.com/library/d...emWebHttpServerUtilityClassTransferTopic2.asp

"Transfer calls End which raises a ThreadAbortException exception upon
completion."

It can be ignored.


Jan said:
Hi,

If I put a try catch block for Server.Transfer call. It will catch a
System.Threading.ThreadAbortException exception like this. However, it
transfer the page to the correct page. Why did this exception occur?

Thanks.
------------------------------------
{"Thread was being aborted." }

[System.Threading.ThreadAbortException]:
{System.Threading.ThreadAbortException}

System.Object: {System.Threading.ThreadAbortException}

_COMPlusExceptionCode: -532459699

_className: "System.Threading.ThreadAbortException"

_exceptionMethod: {System.Reflection.RuntimeMethodInfo}

_exceptionMethodString: null

_message: "Thread was being aborted."

_innerException: null

_helpURL: null

_stackTrace: {System.Array}

_stackTraceString: " at System.Threading.Thread.AbortInternal()

at System.Threading.Thread.Abort(Object stateInfo)

at System.Web.HttpResponse.End()

at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm)

at System.Web.HttpServerUtility.Transfer(String path)

at TestASPNET.Form1.btnTransfer_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\testaspnet\form1.aspx.cs:line 182"

_remoteStackTraceString: null

_remoteStackIndex: 0

_HResult: -2146233040

_source: "mscorlib"

_xptrs: 0

_xcode: -532459699

Message: "Thread was being aborted."

InnerException: null

TargetSite: {System.Reflection.RuntimeMethodInfo}

StackTrace: " at System.Threading.Thread.AbortInternal()

at System.Threading.Thread.Abort(Object stateInfo)

at System.Web.HttpResponse.End()

at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm)

at System.Web.HttpServerUtility.Transfer(String path)

at TestASPNET.Form1.btnTransfer_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\testaspnet\form1.aspx.cs:line 182"

HelpLink: ""

Source: "mscorlib"

HResult: -2146233040
 
J

Jerry III

So the rest of the current request isn't processed.

Personally, I think this is just a bad design on Microsoft's part, the whole
idea of pages posting data back to themselves would cause a lot of
unnecessary overhead if you just want to use Server.Transfer and not create
the whole input page again.

Jerry

Jan said:
Thanks for the info. But what is the purpose of raising this exception?
Tammy said:
from the MSDN site:
http://msdn.microsoft.com/library/d...emWebHttpServerUtilityClassTransferTopic2.asp
"Transfer calls End which raises a ThreadAbortException exception upon
completion."

It can be ignored.


Jan said:
Hi,

If I put a try catch block for Server.Transfer call. It will catch a
System.Threading.ThreadAbortException exception like this. However, it
transfer the page to the correct page. Why did this exception occur?

Thanks.
------------------------------------
{"Thread was being aborted." }

[System.Threading.ThreadAbortException]:
{System.Threading.ThreadAbortException}

System.Object: {System.Threading.ThreadAbortException}

_COMPlusExceptionCode: -532459699

_className: "System.Threading.ThreadAbortException"

_exceptionMethod: {System.Reflection.RuntimeMethodInfo}

_exceptionMethodString: null

_message: "Thread was being aborted."

_innerException: null

_helpURL: null

_stackTrace: {System.Array}

_stackTraceString: " at System.Threading.Thread.AbortInternal()

at System.Threading.Thread.Abort(Object stateInfo)

at System.Web.HttpResponse.End()

at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm)

at System.Web.HttpServerUtility.Transfer(String path)

at TestASPNET.Form1.btnTransfer_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\testaspnet\form1.aspx.cs:line 182"

_remoteStackTraceString: null

_remoteStackIndex: 0

_HResult: -2146233040

_source: "mscorlib"

_xptrs: 0

_xcode: -532459699

Message: "Thread was being aborted."

InnerException: null

TargetSite: {System.Reflection.RuntimeMethodInfo}

StackTrace: " at System.Threading.Thread.AbortInternal()

at System.Threading.Thread.Abort(Object stateInfo)

at System.Web.HttpResponse.End()

at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm)

at System.Web.HttpServerUtility.Transfer(String path)

at TestASPNET.Form1.btnTransfer_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\testaspnet\form1.aspx.cs:line 182"

HelpLink: ""

Source: "mscorlib"

HResult: -2146233040
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,709
Latest member
AustinMudi

Latest Threads

Top