Thread is being aborted

Thread is being aborted

Forum member · Aug 14, 2007
I am using the following code to print the PDF to the browser, however, when I do, I actually end up catching an exception that says the thread is being aborted. Try ' do the stuff to create pdf '.... Response.ClearContent() ThisDocument.DrawToWeb(Me, FileName, False) Response.End() Catch ex as Exception ' this is where I get the "thread is being aborted" message End Try It appears that it is happening at the Response.End call. I guess this means that the response is already ended and that trying to end it throws an error. However, I'd like to keep the Response.End in there to make sure that it continues to render properly (as per the other posts on this forum). Any ideas on how I can prevent this or check if the response is already ended or something?

Re: Thread is being aborted

Support · Aug 14, 2007
Hello, We are unable to recreate the behavior and please try removing the Response.End and see if it sovles the problem. It looks like this is just related to the fact that in general calling the Response.End (or the Response.Redirect or Server.Transfer) is raising the exception. This was talked about in the following forum: http://p2p.wrox.com/topic.asp?TOPIC_ID=5989 Also here is Microsoft's support article on the same issue: http://support.microsoft.com/default.aspx?scid=kb;en-us;312629 Thanks, ceTe Software Support Team.

Re: Thread is being aborted

Forum member · Oct 2, 2007
When I was getting this error, I used HttpContext.Current.ApplicationInstance.CompleteRequest(); instead of Response.End(); and that took care of the issue. Thanks, Mike