3

I have the below code in my ASP.net page:

Response.StatusCode = 404
Response.Write(strResult)
Response.End()

The code above throws "An exception of type 'System.Threading.ThreadAbortException' occurred and was caught."

Can anyone tell me the reason why? And do I solve this.

thanks

Pinoy2015
  • 1,429
  • 15
  • 29
  • 2
    See: http://stackoverflow.com/questions/1087777/is-response-end-considered-harmful and the KB article: http://support.microsoft.com/kb/312629 – Tim M. May 23 '12 at 06:09

1 Answers1

1

Calling Response.End() from any child object of the page will most likely cause the 'System.Threading.ThreadAbortException' exception.

Please read this for a full explaination of why this is happening and methods to avoid/deal with the exception.

angus
  • 690
  • 10
  • 26