Skip to main content
Version: 4.1

HttpResponse

Namespace: Wisej.Core

Assembly: Wisej.Framework (4.1.0.0)

Encapsulates HTTP-response information from an ASP.NET operation.

public class HttpResponse

Properties

Instance member ContentType

String: Returns or set the HTTP MIME type of the output stream.

Instance member Context

HttpContext: Returns the current HttpContext.

Instance member OutputStream

Stream: Enables binary output to the outgoing HTTP content body.

Instance member StatusCode

Int32: Returns or sets the HTTP status code returned to the client.

Instance member StatusDescription

String: Returns or sets the HTTP status string to return to the client.

Methods

Instance member AppendHeader(name, value)

Adds the HTTP header to the response.

ParameterTypeDescription
nameStringName of the HTTP header.
valueStringValue of the HTTP header.

Instance member BinaryWrite(buffer)

Writes an array of bytes to the HTTP output stream.

ParameterTypeDescription
bufferByte[]The bytes to write to the output stream.

Instance member BinaryWrite(buffer, index, count)

Writes an array of bytes to the HTTP output stream.

ParameterTypeDescription
bufferByte[]The bytes to write to the output stream.
indexInt32The position in the byte array where writing starts.
countInt32The number of bytes to write, beginning at index.

Instance member Flush()

Sends all currently buffered output to the client.

Throws:

Instance member Redirect(location, permanent)

Returns a redirect response (HTTP 301 or HTTP 302) to the client.

ParameterTypeDescription
locationStringThe URL to redirect the client to. This must be properly encoded for use in HTTP headers where only ASCII characters are allowed.
permanentBooleanTrue if the redirect is permanent (301), otherwise false (302).

Instance member TransmitFile(filePath)

Writes the specified filePath to the current HTTP response stream without buffering it in memory.

ParameterTypeDescription
filePathStringThe path to the file to writ to the output stream.

Throws:

Instance member TransmitFile(filePath, offset, length)

Writes the specified part of a file directly to an HTTP response output stream without buffering it in memory.

ParameterTypeDescription
filePathStringThe name of the file to write to the HTTP output.
offsetInt64The position in the file to begin to write to the HTTP output.
lengthInt64The 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.

Instance member TransmitImage(image, format)

Writes an image to the HTTP response stream.

ParameterTypeDescription
imageImageThe Image to send.
formatImageFormatImageFormat to use when encoding the image.

Throws:

Instance member TransmitStream(stream)

Copies a stream to the HTTP response stream.

ParameterTypeDescription
streamStreamA Stream to copy to the HTTP output.

Instance member Write(value)

Writes a string to the current HTTP response string.

ParameterTypeDescription
valueStringThe string to write to the response stream.

Instance member Write(obj)

Writes an object to the HTTP response stream.

ParameterTypeDescription
objObjectThe object to write.

Instance member WriteFile(filePath)

Writes the specified filePath to the current HTTP response stream without buffering it in memory.

ParameterTypeDescription
filePathStringThe path to the file to writ to the output stream.

This method is an alias of TransmitFile. Throws:

Instance member WriteFile(filePath, offset, length)

Writes the specified part of a file directly to an HTTP response output stream without buffering it in memory.

ParameterTypeDescription
filePathStringThe name of the file to write to the HTTP output.
offsetInt64The position in the file to begin to write to the HTTP output.
lengthInt64The number of bytes to be transmitted.

This method is an alias of TransmitFile. Throws:

  • ArgumentNullException The filename parameter is null.
  • 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.

Instance member WriteImage(image, format)

Writes an image to the HTTP response stream.

ParameterTypeDescription
imageImageThe Image to send.
formatImageFormatImageFormat to use when encoding the image.

This method is an alias of TransmitImage. Throws:

Instance member WriteStream(stream)

Copies a stream to the HTTP response stream.

ParameterTypeDescription
streamStreamA Stream to copy to the HTTP output.

This method is an alias of TransmitStream. Throws: