System.Net.HttpListenerResponse Class

Represents a response to a request being handled by an System.Net.HttpListener object.

See Also: HttpListenerResponse Members


public sealed class HttpListenerResponse : IDisposable


When a client makes a request for a resource handled by an System.Net.HttpListener object, the request and response are made available to your application in an System.Net.HttpListenerContext object. The request is represented by an System.Net.HttpListenerRequest object and is available in the HttpListenerContext.Request property. The response is represented by an System.Net.HttpListenerResponse object and is available in the HttpListenerContext.Response property.

You can customize the response by setting various properties, such as HttpListenerResponse.StatusCode, HttpListenerResponse.StatusDescription, and HttpListenerResponse.Cookies. Use the HttpListenerResponse.OutputStream property to obtain a System.IO.Stream instance to which response data can be written. Finally, send the response data to the client by calling the erload:System.Net.HttpListenerResponse.Close method.


Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions:,
Since: .NET 2.0