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

Close() private method

private Close ( ) : void
return void
        internal void Close()
        {
            if (NetEventSource.IsEnabled) NetEventSource.Enter(this);

            try
            {
                _response?.Close();
            }
            finally
            {
                try
                {
                    Request.Close();
                }
                finally
                {
                    IDisposable user = _user == null ? null : _user.Identity as IDisposable;

                    // For unsafe connection ntlm auth we dont dispose this identity as yet since its cached
                    if ((user != null) &&
                        (_user.Identity.AuthenticationType != AuthConstants.NTLM) &&
                        (!_listener.UnsafeConnectionNtlmAuthentication))
                    {
                        user.Dispose();
                    }
                }
            }
            if (NetEventSource.IsEnabled) NetEventSource.Exit(this);
        }

Usage Example

        private void Dispose(bool disposing)
        {
            if (_responseState >= ResponseState.Closed)
            {
                return;
            }
            EnsureResponseStream();
            _responseStream.Close();
            _responseState = ResponseState.Closed;

            HttpListenerContext.Close();
        }
All Usage Examples Of System.Net.HttpListenerContext::Close