System.Net.HttpListenerContext.ForceCancelRequest C# (CSharp) Method

ForceCancelRequest() private method

private ForceCancelRequest ( SafeHandle requestQueueHandle, ulong requestId ) : void
requestQueueHandle SafeHandle
requestId ulong
return void
        internal void ForceCancelRequest(SafeHandle requestQueueHandle, ulong requestId)
        {
            uint statusCode = Interop.HttpApi.HttpCancelHttpRequest(requestQueueHandle, requestId,
                IntPtr.Zero);

            // Either the connection has already dropped, or the last write is in progress.
            // The requestId becomes invalid as soon as the last Content-Length write starts.
            // The only way to cancel now is with CancelIoEx.
            if (statusCode == Interop.HttpApi.ERROR_CONNECTION_INVALID)
            {
                _response.CancelLastWrite(requestQueueHandle);
            }
        }