HttpResponse
Namespace: Wisej.Core
Assembly: Wisej.Framework (3.5.0.0)
Encapsulates HTTP-response information from an ASP.NET operation.
- C#
- VB.NET
public class HttpResponse
Public Class HttpResponse
Properties
ContentType
String: Returns or set the HTTP MIME type of the output stream.
Context
HttpContext: Returns the current HttpContext.
OutputStream
Stream: Enables binary output to the outgoing HTTP content body.
StatusCode
Int32: Returns or sets the HTTP status code returned to the client.
StatusDescription
String: Returns or sets the HTTP status string to return to the client.
Methods
AppendHeader(name, value)
Adds the HTTP header to the response.
| Parameter | Type | Description |
|---|---|---|
| name | String | Name of the HTTP header. |
| value | String | Value of the HTTP header. |
BinaryWrite(buffer)
Writes an array of bytes to the HTTP output stream.
| Parameter | Type | Description |
|---|---|---|
| buffer | Byte[] | The bytes to write to the output stream. |
BinaryWrite(buffer, index, count)
Writes an array of bytes to the HTTP output stream.
| Parameter | Type | Description |
|---|---|---|
| buffer | Byte[] | The bytes to write to the output stream. |
| index | Int32 | The position in the byte array where writing starts. |
| count | Int32 | The number of bytes to write, beginning at index. |
Flush()
Sends all currently buffered output to the client.
Throws:
- HttpException An I/O error occurs.
Redirect(location, permanent)
Returns a redirect response (HTTP 301 or HTTP 302) to the client.
| Parameter | Type | Description |
|---|---|---|
| location | String | The URL to redirect the client to. This must be properly encoded for use in HTTP headers where only ASCII characters are allowed. |
| permanent | Boolean | True if the redirect is permanent (301), otherwise false (302). |
TransmitFile(filePath)
Writes the specified filePath to the current HTTP response stream without buffering it in memory.
| Parameter | Type | Description |
|---|---|---|
| filePath | String | The path to the file to writ to the output stream. |
Throws:
- ArgumentNullException The filename parameter is null.
TransmitFile(filePath, offset, length)
Writes the specified part of a file directly to an HTTP response output stream without buffering it in memory.
| Parameter | Type | Description |
|---|---|---|
| filePath | String | The name of the file to write to the HTTP output. |
| offset | Int64 | The position in the file to begin to write to the HTTP output. |
| length | Int64 | The number of bytes to be transmitted. |
Throws:
- ArgumentNullException The filename parameter is null.
- PlatformNotSupportedException The out-of-process worker request is not supported.- or -The response is not using an HttpWriter object.
- ArgumentException The offset parameter is less than zero or greater than the file size.- or -The length parameter is less than -1 or greater than the value of the offset parameter plus the file size.
TransmitImage(image, format)
Writes an image to the HTTP response stream.
| Parameter | Type | Description |
|---|---|---|
| image | Image | The Image to send. |
| format | ImageFormat | ImageFormat to use when encoding the image. |
Throws:
- NullReferenceException image is null.
TransmitStream(stream)
Copies a stream to the HTTP response stream.
| Parameter | Type | Description |
|---|---|---|
| stream | Stream | A Stream to copy to the HTTP output. |
Write(value)
Writes a string to the current HTTP response string.
| Parameter | Type | Description |
|---|---|---|
| value | String | The string to write to the response stream. |
Write(obj)
Writes an object to the HTTP response stream.
| Parameter | Type | Description |
|---|---|---|
| obj | Object | The object to write. |