Search code examples
c#asp.netwebformshttpresponsehttpcontext

How to abort request like IIS request Abort in ASP.NET using C#


I just want to abort request like IIS request abort. I am not sure how can I do it in C# but need some expert to do it.

Can we abort user request in IHttpModule? I can do response.end() but couldn't see the message like: ERR_CONNECTION_TIMED_OUT

Here is my code to end request in IHttpModule. If it's possible I want to abort user's request.

private void context_BeginRequest(object sender, EventArgs e)
{
   HttpContext.Current.Response.End();
}

Result is empty screen with this code. Expected result is ERR_CONNECTION_TIMED_OUT


Solution

  • The Response.End() is closing the connection, its abort on your side, and on client side is just stops the loading - close the connection - Not leave it open until gets time out -

    So its normal what you get - not a time out