As mentioned in Microsoft documentation:
Exception when you use Server.Transfer - ASP.NET | Microsoft Docs[
^]
Quote:
When you call Server.Transfer, ASP.NET internally calls the Server.Execute method to transfer the control, and calls the Response.End method to end the processing of the current page. Response.End ends the page execution and calls the Thread.Abort method. The Thread.Abort method causes the ThreadAbortException error message to appear.
To work around this problem, use
Server.Execute
instead of
Server.Transfer
in the
ProcessRequest
method of
HTTPHandler
. The modified
ProcessRequest
method is as follows:
public void ProcessRequest(HttpContext context)
{
try
{
context.Server.Execute("WebForm1.aspx");
}
catch(System.Exception e)
{
context.Response.Write(e.StackTrace);
context.Response.Write(e.ToString());
}
}