Search code examples
threadabortexceptionthread-exceptions

system.threading .threadAbortException error


I am taking over an existing website and I am trying to get the application running on my machine, however I can't launch the application because I get the following error.

System.Threading.ThreadAbortException occurred
HResult=0x80131530
Message=Thread was being aborted.
Source=mscorlib
StackTrace:
at System.Threading.Thread.AbortInternal()
at System.Threading.Thread.Abort(Object stateInfo)

This is my code

protected void Application_BeginRequest(object sender, EventArgs e) {
            if (DemoWeb.Helpers.Application.ApplicationManager.StartUpError != "") 
         {

           Response.Write("<div class=\"demoweb-securityerror\">" + demoweb.Helpers.Application.ApplicationManager.StartUpError + "</div>");
                Response.End();
          }

How can I get it to bypass the response.end?


Solution

  • I got it to work. I just added a try and catch method and moved the Response.End

    try {
      // code 
      }
    catch(exception ex)
      {
       Response.End();
      }