Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » Response.End throws ThreadAbortException

Response.End throws ThreadAbortException

Jakob Kristensen
Reply

Hi Guys,

I am using a razor template to implement an instant search in DW9 (9.2.15) environment.

    context.Response.Clear();
    context.Response.ContentType = "application/json";
    context.Response.Write(GetProductList1(GetLoop("Products")));
    context.Response.End();

The fetaure is working fine but except the Response.End which throws an exception for every 3. or 4. attempts.
It has affected the performance and takes 5-6 seconds to display the result. 

System.Threading.ThreadAbortException: Thread was being aborted.
   at System.Threading.Thread.AbortInternal()
   at System.Threading.Thread.Abort(Object stateInfo)
   at System.Web.HttpResponse.AbortCurrentThread()
   at System.Web.HttpResponse.End()
   at CompiledRazorTemplates.Dynamic.acafaeafdabe.Execute()


Does anyone have any experience with the current issue?

Ps. The same solution is implemented in DW8 environments without any issues.

Thanks
Jakob


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Jakob

Response.end will ALWAYS throw a ThreadAbortException. See https://msdn.microsoft.com/en-us/library/system.web.httpresponse.end(v=vs.110).aspx

That also covers what else to do.

You should avoid it in this scenario.

BR Nicolai

Votes for this answer: 1
 
Jakob Kristensen
Reply

Thanks for your feedback, Nicolai

Br.
Jakob

 

You must be logged in to post in the forum