Represents a response to a request being handled by an HttpListener object.
Assembly: System (in System.dll)
Thetype exposes the following members.
|ContentEncoding||Gets or sets the Encoding for this response's OutputStream.|
|ContentLength64||Gets or sets the number of bytes in the body data included in the response.|
|ContentType||Gets or sets the MIME type of the content returned.|
|Cookies||Gets or sets the collection of cookies returned with the response.|
|Headers||Gets or sets the collection of header name/value pairs returned by the server.|
|KeepAlive||Gets or sets a value indicating whether the server requests a persistent connection.|
|OutputStream||Gets a Stream object to which a response can be written.|
|ProtocolVersion||Gets or sets the HTTP version used for the response.|
|RedirectLocation||Gets or sets the value of the HTTP Location header in this response.|
|SendChunked||Gets or sets whether the response uses chunked transfer encoding.|
|StatusCode||Gets or sets the HTTP status code to be returned to the client.|
|StatusDescription||Gets or sets a text description of the HTTP status code returned to the client.|
|Abort||Closes the connection to the client without sending a response.|
|AddHeader||Adds the specified header and value to the HTTP headers for this response.|
|AppendCookie||Adds the specified Cookie to the collection of cookies for this response.|
|AppendHeader||Appends a value to the specified HTTP header to be sent with this response.|
|Close()||Sends the response to the client and releases the resources held by this instance.|
|Close(Byte, Boolean)||Returns the specified byte array to the client and releases the resources held by this instance.|
|CopyFrom||Copies properties from the specified to this response.|
|Equals(Object)||Determines whether the specified Object is equal to the current Object. (Inherited from Object.)|
|Finalize||Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)|
|GetHashCode||Serves as a hash function for a particular type. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|Redirect||Configures the response to redirect the client to the specified URL.|
|SetCookie||Adds or updates a Cookie in the collection of cookies sent with this response.|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
When a client makes a request for a resource handled by an HttpListener object, the request and response are made available to your application in an HttpListenerContext object. The request is represented by an HttpListenerRequest object and is available in the HttpListenerContext.Request property. The response is represented by an object and is available in the HttpListenerContext.Response property.
You can customize the response by setting various properties, such as StatusCode, StatusDescription, and Cookies. Use the HttpListenerResponse.OutputStream property to obtain a Stream instance to which response data can be written. Finally, send the response data to the client by calling the Close method.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.