ASP.NET end response without ThreadAbortException

Thanks to this answer on StackOverflow for this answer:

// Sends all currently buffered output to the client.
HttpContext.Current.Response.Flush(); 
 
// Gets or sets a value indicating whether to send HTTP content to the client.
HttpContext.Current.Response.SuppressContent = true;  
 
// Causes ASP.NET to bypass all events and filtering in the HTTP pipeline chain of execution and directly execute the EndRequest event.
HttpContext.Current.ApplicationInstance.CompleteRequest(); 

Comments

Popular posts from this blog

C# Record Serialization

Add timestamp to photo using ImageMagick

Read/write large blob to SQL Server from C#