HttpServerResponse
constructor
Creates a new instance of the HttpServerResponse class.
constructor(header: HttpHeaders)
HttpServerResponse(HttpHeaders header)
init(_ header: HttpHeaders)
Sub New(header As HttpHeaders)
Parameters:
- header:
Client protected override
Gets flag indicating whether the request is being processed on the client side.
Returns false
property Client: Boolean read;
var Client: Boolean { get{} }
ReadOnly Property Client() As Boolean
method CloneEvents(source: HttpRequestResponse)
void CloneEvents(HttpRequestResponse source)
func CloneEvents(_ source: HttpRequestResponse)
Sub CloneEvents(source As HttpRequestResponse)
Parameters:
- source:
When ContentSource is set to ContentStream (and a ContentStream is assigned), this property determines if the stream should be closed automatically after sending it to the connection (true) or not (false).
property CloseStream: Boolean read write;
Boolean CloseStream { get; set; }
var CloseStream: Boolean { get{} set{} }
Property CloseStream() As Boolean
Code virtual obsolete
Gets or sets the HTTP status code of the response. This property is obsolete, consider using the HttpCode property instead.
The default value is 200
property Code: Int32 read write;
var Code: Int32 { get{} set{} }
ContentBytes virtual (declared in HttpOutgoingRequestResponse)
Assigns a byte array to send back as HTTP body to this property.
property ContentBytes: array of Byte read write;
Byte[] ContentBytes { get; set; }
var ContentBytes: Byte... { get{} set{} }
Property ContentBytes() As Byte()
ContentSource virtual (declared in HttpOutgoingRequestResponse)
Defines which property (ContentBytes, ContentStream or ContantString) will be used to send the body of the response. Assigning any of these three properties will automatically set the ContentSource property so that the content will always be sent from the appropriate source.
property ContentSource: ContentSource read write;
ContentSource ContentSource { get; set; }
var ContentSource: ContentSource { get{} set{} }
Property ContentSource() As ContentSource
ContentStream virtual (declared in HttpOutgoingRequestResponse)
Assigns a stream to send back as HTTP body to this property. When assigned (and ContentSource is set to ContentStream), you can use the CloseStream property to determine if the stream should be closed automatically after sending it to the connection (true) or not (false).
property ContentStream: Stream read write;
Stream ContentStream { get; set; }
var ContentStream: Stream { get{} set{} }
Property ContentStream() As Stream
ContentString virtual (declared in HttpOutgoingRequestResponse)
Assigns a string to send back as HTTP body to this property.
property ContentString: String read write;
String ContentString { get; set; }
var ContentString: String { get{} set{} }
Property ContentString() As String
property Cookies: HttpCookieCollection read write;
HttpCookieCollection Cookies { get; set; }
var Cookies: HttpCookieCollection { get{} set{} }
Property Cookies() As HttpCookieCollection
property Encoding: Encoding read write;
Encoding Encoding { get; set; }
var Encoding: Encoding { get{} set{} }
Property Encoding() As Encoding
This method finalizes the HTTP header.
It sets the correct value of the Content-Length header and sets the HTTP version header to 1.1.
method HandleOnBytesSent(sender: Object; e: EventArgs)
void HandleOnBytesSent(Object sender, EventArgs e)
func HandleOnBytesSent(_ sender: Object, _ e: EventArgs)
Sub HandleOnBytesSent(sender As Object, e As EventArgs)
Parameters:
- sender:
- e:
property HasOnTransferProgress: Boolean read;
Boolean HasOnTransferProgress { get; }
var HasOnTransferProgress: Boolean { get{} }
ReadOnly Property HasOnTransferProgress() As Boolean
property Header: HttpHeaders read write;
HttpHeaders Header { get; set; }
var Header: HttpHeaders { get{} set{} }
Property Header() As HttpHeaders
HttpCode virtual
Gets or sets the HTTP status code of the response.
The default value is HttpStatusCode.OK
property HttpCode: HttpStatusCode read write;
HttpStatusCode HttpCode { get; set; }
var HttpCode: HttpStatusCode { get{} set{} }
Property HttpCode() As HttpStatusCode
property KeepAlive: Boolean read write;
Boolean KeepAlive { get; set; }
var KeepAlive: Boolean { get{} set{} }
Property KeepAlive() As Boolean
event OnTransferEnd: TransferEndEventHandler
delegate: method OnTransferEnd(sender: Object; e: TransferEndEventArgs)
delegate TransferEndEventHandler OnTransferEnd()
delegate: void OnTransferEnd(Object sender, TransferEndEventArgs e)
__event TransferEndEventHandler: OnTransferEnd!
delegate: func OnTransferEnd(_ sender: Object, _ e: TransferEndEventArgs)
Event OnTransferEnd As TransferEndEventHandler
delegate: Sub OnTransferEnd(sender As Object, e As TransferEndEventArgs)
event OnTransferProgress: TransferProgressEventHandler
delegate: method OnTransferProgress(sender: Object; e: TransferProgressEventArgs)
delegate TransferProgressEventHandler OnTransferProgress()
delegate: void OnTransferProgress(Object sender, TransferProgressEventArgs e)
__event TransferProgressEventHandler: OnTransferProgress!
delegate: func OnTransferProgress(_ sender: Object, _ e: TransferProgressEventArgs)
Event OnTransferProgress As TransferProgressEventHandler
delegate: Sub OnTransferProgress(sender As Object, e As TransferProgressEventArgs)
event OnTransferStart: TransferStartEventHandler
delegate: method OnTransferStart(sender: Object; e: TransferStartEventArgs)
delegate TransferStartEventHandler OnTransferStart()
delegate: void OnTransferStart(Object sender, TransferStartEventArgs e)
__event TransferStartEventHandler: OnTransferStart!
delegate: func OnTransferStart(_ sender: Object, _ e: TransferStartEventArgs)
Event OnTransferStart As TransferStartEventHandler
delegate: Sub OnTransferStart(sender As Object, e As TransferStartEventArgs)
ResponseText virtual
Gets or sets the HTTP status code description (f.e. OK when the Code is 200).
It is up to the caller to ensure that the Code and the ResponseText values correspond to each other.
This property is obsolete, consider using the HttpCode property instead.
The default value is OK
property ResponseText: String read;
String ResponseText { get; }
var ResponseText: String { get{} }
ReadOnly Property ResponseText() As String
SendError (Int32, Exception) obsolete .NET, .NET Core 5.0, .NET Standard 2.0
Prepares a server response containing an error message.
This method converts the provided exception into string wraps and wraps the resulting error message into an HTML document that is put into the ContentBytes data stream.
method SendError(responseCode: Int32; ex: Exception)
void SendError(Int32 responseCode, Exception ex)
func SendError(_ responseCode: Int32, _ ex: Exception)
Sub SendError(responseCode As Int32, ex As Exception)
Parameters:
- responseCode: HTTP response code
- ex: Exception
method SendError(responseCode: Int32; ex: Exception)
void SendError(Int32 responseCode, Exception ex)
func SendError(_ responseCode: Int32, _ ex: Exception)
Sub SendError(responseCode As Int32, ex As Exception)
Parameters:
- responseCode:
- ex:
Prepares a server response containing an error message.
This method wraps the provided error message into an HTML document and puts the resulting document into the ContentBytes data stream.
method SendError(responseCode: Int32; message: String)
void SendError(Int32 responseCode, String message)
func SendError(_ responseCode: Int32, _ message: String)
Sub SendError(responseCode As Int32, message As String)
Parameters:
- responseCode: HTTP response code
- message: Error message
method SendError(responseCode: HttpStatusCode; ex: Exception)
void SendError(HttpStatusCode responseCode, Exception ex)
func SendError(_ responseCode: HttpStatusCode, _ ex: Exception)
Sub SendError(responseCode As HttpStatusCode, ex As Exception)
Parameters:
- responseCode:
- ex:
method SendError(responseCode: HttpStatusCode; ex: Exception)
void SendError(HttpStatusCode responseCode, Exception ex)
func SendError(_ responseCode: HttpStatusCode, _ ex: Exception)
Sub SendError(responseCode As HttpStatusCode, ex As Exception)
Parameters:
- responseCode:
- ex:
method SendError(responseCode: HttpStatusCode; message: String)
void SendError(HttpStatusCode responseCode, String message)
func SendError(_ responseCode: HttpStatusCode, _ message: String)
Sub SendError(responseCode As HttpStatusCode, message As String)
Parameters:
- responseCode:
- message:
SendErrorWithCustomBody (Int32, String) virtual obsolete
Prepares a server response containing an error message.
This method threats the provided error message as a valid HTML document and puts the resulting document into the ContentBytes data stream. This method can be used to prepare error responses with custom error text formatting.
method SendErrorWithCustomBody(responseCode: Int32; message: String)
void SendErrorWithCustomBody(Int32 responseCode, String message)
func SendErrorWithCustomBody(_ responseCode: Int32, _ message: String)
Sub SendErrorWithCustomBody(responseCode As Int32, message As String)
Parameters:
- responseCode: HTTP response code
- message: Error message
SendErrorWithCustomBody (HttpStatusCode, String) virtual
method SendErrorWithCustomBody(responseCode: HttpStatusCode; message: String)
void SendErrorWithCustomBody(HttpStatusCode responseCode, String message)
func SendErrorWithCustomBody(_ responseCode: HttpStatusCode, _ message: String)
Sub SendErrorWithCustomBody(responseCode As HttpStatusCode, message As String)
Parameters:
- responseCode:
- message:
Server protected override obsolete
Gets flag indicating whether the request is being processed on the server side.
Returns true
property Server: Boolean read;
var Server: Boolean { get{} }
ReadOnly Property Server() As Boolean
method TriggerOnTransferEnd(direction: TransferDirection)
void TriggerOnTransferEnd(TransferDirection direction)
func TriggerOnTransferEnd(_ direction: TransferDirection)
Sub TriggerOnTransferEnd(direction As TransferDirection)
Parameters:
- direction:
TriggerOnTransferProgress protected virtual (declared in HttpRequestResponse)
method TriggerOnTransferProgress(direction: TransferDirection; position: Int64)
void TriggerOnTransferProgress(TransferDirection direction, Int64 position)
func TriggerOnTransferProgress(_ direction: TransferDirection, _ position: Int64)
Sub TriggerOnTransferProgress(direction As TransferDirection, position As Int64)
Parameters:
- direction:
- position:
method TriggerOnTransferStart(direction: TransferDirection; size: Int64)
void TriggerOnTransferStart(TransferDirection direction, Int64 size)
func TriggerOnTransferStart(_ direction: TransferDirection, _ size: Int64)
Sub TriggerOnTransferStart(direction As TransferDirection, size As Int64)
Parameters:
- direction:
- size:
WriteBodyToConnection virtual (declared in HttpOutgoingRequestResponse)
method WriteBodyToConnection(connection: Connection)
void WriteBodyToConnection(Connection connection)
func WriteBodyToConnection(_ connection: Connection)
Sub WriteBodyToConnection(connection As Connection)
Parameters:
- connection:
method WriteHeaderToConnection(connection: Connection)
void WriteHeaderToConnection(Connection connection)
func WriteHeaderToConnection(_ connection: Connection)
Sub WriteHeaderToConnection(connection As Connection)
Parameters:
- connection:
method WriteToConnection(connection: Connection)
void WriteToConnection(Connection connection)
func WriteToConnection(_ connection: Connection)
Sub WriteToConnection(connection As Connection)
Parameters:
- connection:
Client protected override
Gets flag indicating whether the request is being processed on the client side.
Returns false
property Client: Boolean read;
var Client: Boolean { get{} }
ReadOnly Property Client() As Boolean
When ContentSource is set to ContentStream (and a ContentStream is assigned), this property determines if the stream should be closed automatically after sending it to the connection (true) or not (false).
property CloseStream: Boolean read write;
Boolean CloseStream { get; set; }
var CloseStream: Boolean { get{} set{} }
Property CloseStream() As Boolean
Code virtual obsolete
Gets or sets the HTTP status code of the response. This property is obsolete, consider using the HttpCode property instead.
The default value is 200
property Code: Int32 read write;
var Code: Int32 { get{} set{} }
ContentBytes virtual (declared in HttpOutgoingRequestResponse)
Assigns a byte array to send back as HTTP body to this property.
property ContentBytes: array of Byte read write;
Byte[] ContentBytes { get; set; }
var ContentBytes: Byte... { get{} set{} }
Property ContentBytes() As Byte()
ContentSource virtual (declared in HttpOutgoingRequestResponse)
Defines which property (ContentBytes, ContentStream or ContantString) will be used to send the body of the response. Assigning any of these three properties will automatically set the ContentSource property so that the content will always be sent from the appropriate source.
property ContentSource: ContentSource read write;
ContentSource ContentSource { get; set; }
var ContentSource: ContentSource { get{} set{} }
Property ContentSource() As ContentSource
ContentStream virtual (declared in HttpOutgoingRequestResponse)
Assigns a stream to send back as HTTP body to this property. When assigned (and ContentSource is set to ContentStream), you can use the CloseStream property to determine if the stream should be closed automatically after sending it to the connection (true) or not (false).
property ContentStream: Stream read write;
Stream ContentStream { get; set; }
var ContentStream: Stream { get{} set{} }
Property ContentStream() As Stream
ContentString virtual (declared in HttpOutgoingRequestResponse)
Assigns a string to send back as HTTP body to this property.
property ContentString: String read write;
String ContentString { get; set; }
var ContentString: String { get{} set{} }
Property ContentString() As String
property Cookies: HttpCookieCollection read write;
HttpCookieCollection Cookies { get; set; }
var Cookies: HttpCookieCollection { get{} set{} }
Property Cookies() As HttpCookieCollection
property Encoding: Encoding read write;
Encoding Encoding { get; set; }
var Encoding: Encoding { get{} set{} }
Property Encoding() As Encoding
property HasOnTransferProgress: Boolean read;
Boolean HasOnTransferProgress { get; }
var HasOnTransferProgress: Boolean { get{} }
ReadOnly Property HasOnTransferProgress() As Boolean
property Header: HttpHeaders read write;
HttpHeaders Header { get; set; }
var Header: HttpHeaders { get{} set{} }
Property Header() As HttpHeaders
HttpCode virtual
Gets or sets the HTTP status code of the response.
The default value is HttpStatusCode.OK
property HttpCode: HttpStatusCode read write;
HttpStatusCode HttpCode { get; set; }
var HttpCode: HttpStatusCode { get{} set{} }
Property HttpCode() As HttpStatusCode
property KeepAlive: Boolean read write;
Boolean KeepAlive { get; set; }
var KeepAlive: Boolean { get{} set{} }
Property KeepAlive() As Boolean
ResponseText virtual
Gets or sets the HTTP status code description (f.e. OK when the Code is 200).
It is up to the caller to ensure that the Code and the ResponseText values correspond to each other.
This property is obsolete, consider using the HttpCode property instead.
The default value is OK
property ResponseText: String read;
String ResponseText { get; }
var ResponseText: String { get{} }
ReadOnly Property ResponseText() As String
Server protected override obsolete
Gets flag indicating whether the request is being processed on the server side.
Returns true
property Server: Boolean read;
var Server: Boolean { get{} }
ReadOnly Property Server() As Boolean
constructor
Creates a new instance of the HttpServerResponse class.
constructor(header: HttpHeaders)
HttpServerResponse(HttpHeaders header)
init(_ header: HttpHeaders)
Sub New(header As HttpHeaders)
Parameters:
- header:
method CloneEvents(source: HttpRequestResponse)
void CloneEvents(HttpRequestResponse source)
func CloneEvents(_ source: HttpRequestResponse)
Sub CloneEvents(source As HttpRequestResponse)
Parameters:
- source:
This method finalizes the HTTP header.
It sets the correct value of the Content-Length header and sets the HTTP version header to 1.1.
method HandleOnBytesSent(sender: Object; e: EventArgs)
void HandleOnBytesSent(Object sender, EventArgs e)
func HandleOnBytesSent(_ sender: Object, _ e: EventArgs)
Sub HandleOnBytesSent(sender As Object, e As EventArgs)
Parameters:
- sender:
- e:
SendError (Int32, Exception) obsolete .NET, .NET Core 5.0, .NET Standard 2.0
Prepares a server response containing an error message.
This method converts the provided exception into string wraps and wraps the resulting error message into an HTML document that is put into the ContentBytes data stream.
method SendError(responseCode: Int32; ex: Exception)
void SendError(Int32 responseCode, Exception ex)
func SendError(_ responseCode: Int32, _ ex: Exception)
Sub SendError(responseCode As Int32, ex As Exception)
Parameters:
- responseCode: HTTP response code
- ex: Exception
method SendError(responseCode: Int32; ex: Exception)
void SendError(Int32 responseCode, Exception ex)
func SendError(_ responseCode: Int32, _ ex: Exception)
Sub SendError(responseCode As Int32, ex As Exception)
Parameters:
- responseCode:
- ex:
Prepares a server response containing an error message.
This method wraps the provided error message into an HTML document and puts the resulting document into the ContentBytes data stream.
method SendError(responseCode: Int32; message: String)
void SendError(Int32 responseCode, String message)
func SendError(_ responseCode: Int32, _ message: String)
Sub SendError(responseCode As Int32, message As String)
Parameters:
- responseCode: HTTP response code
- message: Error message
method SendError(responseCode: HttpStatusCode; ex: Exception)
void SendError(HttpStatusCode responseCode, Exception ex)
func SendError(_ responseCode: HttpStatusCode, _ ex: Exception)
Sub SendError(responseCode As HttpStatusCode, ex As Exception)
Parameters:
- responseCode:
- ex:
method SendError(responseCode: HttpStatusCode; ex: Exception)
void SendError(HttpStatusCode responseCode, Exception ex)
func SendError(_ responseCode: HttpStatusCode, _ ex: Exception)
Sub SendError(responseCode As HttpStatusCode, ex As Exception)
Parameters:
- responseCode:
- ex:
method SendError(responseCode: HttpStatusCode; message: String)
void SendError(HttpStatusCode responseCode, String message)
func SendError(_ responseCode: HttpStatusCode, _ message: String)
Sub SendError(responseCode As HttpStatusCode, message As String)
Parameters:
- responseCode:
- message:
SendErrorWithCustomBody (Int32, String) virtual obsolete
Prepares a server response containing an error message.
This method threats the provided error message as a valid HTML document and puts the resulting document into the ContentBytes data stream. This method can be used to prepare error responses with custom error text formatting.
method SendErrorWithCustomBody(responseCode: Int32; message: String)
void SendErrorWithCustomBody(Int32 responseCode, String message)
func SendErrorWithCustomBody(_ responseCode: Int32, _ message: String)
Sub SendErrorWithCustomBody(responseCode As Int32, message As String)
Parameters:
- responseCode: HTTP response code
- message: Error message
SendErrorWithCustomBody (HttpStatusCode, String) virtual
method SendErrorWithCustomBody(responseCode: HttpStatusCode; message: String)
void SendErrorWithCustomBody(HttpStatusCode responseCode, String message)
func SendErrorWithCustomBody(_ responseCode: HttpStatusCode, _ message: String)
Sub SendErrorWithCustomBody(responseCode As HttpStatusCode, message As String)
Parameters:
- responseCode:
- message:
method TriggerOnTransferEnd(direction: TransferDirection)
void TriggerOnTransferEnd(TransferDirection direction)
func TriggerOnTransferEnd(_ direction: TransferDirection)
Sub TriggerOnTransferEnd(direction As TransferDirection)
Parameters:
- direction:
TriggerOnTransferProgress protected virtual (declared in HttpRequestResponse)
method TriggerOnTransferProgress(direction: TransferDirection; position: Int64)
void TriggerOnTransferProgress(TransferDirection direction, Int64 position)
func TriggerOnTransferProgress(_ direction: TransferDirection, _ position: Int64)
Sub TriggerOnTransferProgress(direction As TransferDirection, position As Int64)
Parameters:
- direction:
- position:
method TriggerOnTransferStart(direction: TransferDirection; size: Int64)
void TriggerOnTransferStart(TransferDirection direction, Int64 size)
func TriggerOnTransferStart(_ direction: TransferDirection, _ size: Int64)
Sub TriggerOnTransferStart(direction As TransferDirection, size As Int64)
Parameters:
- direction:
- size:
WriteBodyToConnection virtual (declared in HttpOutgoingRequestResponse)
method WriteBodyToConnection(connection: Connection)
void WriteBodyToConnection(Connection connection)
func WriteBodyToConnection(_ connection: Connection)
Sub WriteBodyToConnection(connection As Connection)
Parameters:
- connection:
method WriteHeaderToConnection(connection: Connection)
void WriteHeaderToConnection(Connection connection)
func WriteHeaderToConnection(_ connection: Connection)
Sub WriteHeaderToConnection(connection As Connection)
Parameters:
- connection:
method WriteToConnection(connection: Connection)
void WriteToConnection(Connection connection)
func WriteToConnection(_ connection: Connection)
Sub WriteToConnection(connection As Connection)
Parameters:
- connection:
event OnTransferEnd: TransferEndEventHandler
delegate: method OnTransferEnd(sender: Object; e: TransferEndEventArgs)
delegate TransferEndEventHandler OnTransferEnd()
delegate: void OnTransferEnd(Object sender, TransferEndEventArgs e)
__event TransferEndEventHandler: OnTransferEnd!
delegate: func OnTransferEnd(_ sender: Object, _ e: TransferEndEventArgs)
Event OnTransferEnd As TransferEndEventHandler
delegate: Sub OnTransferEnd(sender As Object, e As TransferEndEventArgs)
event OnTransferProgress: TransferProgressEventHandler
delegate: method OnTransferProgress(sender: Object; e: TransferProgressEventArgs)
delegate TransferProgressEventHandler OnTransferProgress()
delegate: void OnTransferProgress(Object sender, TransferProgressEventArgs e)
__event TransferProgressEventHandler: OnTransferProgress!
delegate: func OnTransferProgress(_ sender: Object, _ e: TransferProgressEventArgs)
Event OnTransferProgress As TransferProgressEventHandler
delegate: Sub OnTransferProgress(sender As Object, e As TransferProgressEventArgs)
event OnTransferStart: TransferStartEventHandler
delegate: method OnTransferStart(sender: Object; e: TransferStartEventArgs)
delegate TransferStartEventHandler OnTransferStart()
delegate: void OnTransferStart(Object sender, TransferStartEventArgs e)
__event TransferStartEventHandler: OnTransferStart!
delegate: func OnTransferStart(_ sender: Object, _ e: TransferStartEventArgs)
Event OnTransferStart As TransferStartEventHandler
delegate: Sub OnTransferStart(sender As Object, e As TransferStartEventArgs)