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

Close() public method

public Close ( ) : void
return void
        public void Close()
        {
            if (NetEventSource.IsEnabled) NetEventSource.Enter(this);
            try
            {
                if (NetEventSource.IsEnabled) NetEventSource.Info(this);
                ((IDisposable)this).Dispose();
            }
            finally
            {
                if (NetEventSource.IsEnabled) NetEventSource.Exit(this);
            }
        }

Same methods

HttpListenerResponse::Close ( byte responseEntity, bool willBlock ) : void

Usage Example

Esempio n. 1
0
		public void Process(HttpListenerRequest request, HttpListenerResponse response)
		{
			try
			{
				if (request.HttpMethod != "GET")
				{
					response.StatusCode = 405;
					response.StatusDescription = "Method Not Supported";
					response.Close();
					return;
				}

				string version = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion;
				string status = GetStatusDescription();
				string timestamp = DateTime.UtcNow.ToString("s", CultureInfo.InvariantCulture) + "Z";

				FormatJsonResponse(response, version, status, timestamp);
			}
			catch (HttpListenerException hlex)
			{
				Supervisor.LogException(hlex, TraceEventType.Error, request.RawUrl);

				response.StatusCode = 500;
				response.StatusDescription = "Error Occurred";
				response.Close();
			}
		}
All Usage Examples Of System.Net.HttpListenerResponse::Close