Class

WebResponse


Description

The response to a WebRequest.

Properties

Name

Type

Read-Only

Shared

File

FolderItem

MIMEType

String

Status

Integer

Methods

Name

Parameters

Returns

Shared

ClearCookie

Name As String, Domain As String = ".", Path As String = "/", secure As Boolean = False, HttpOnly As Boolean = False

Header

name As String

String

Reset

SetCookie

Name As String, Value As String, Expiration As DateTime = Nil, Domain As String = ".", Path As String = "/", Secure As Boolean = False, HttpOnly As Boolean = False

Write

data As String

Property descriptions


WebResponse.File

File As FolderItem

Specifies a FolderItem to be returned to the browser. Setting this property automatically clears the text buffer.


WebResponse.MIMEType

MIMEType As String

Gets or sets the HTTP "Content-Type" header.

This property is read-only.

The default value is "text/html".


WebResponse.Status

Status As Integer

Gets or sets the HTTP response status.

This property is read-only.

Common values are 200, 301, 302, 403, 404, and 500. The default value is 200. The complete list of valid status codes is available at here.

Method descriptions


WebResponse.ClearCookie

ClearCookie(Name As String, Domain As String = ".", Path As String = "/", Secure As Boolean = False, HTTPOnly As Boolean = False)

Clears all data from the cookie at the location specified.

Parameter

Description

Name

Name of the cookie to set so you can retrieve the value later with the Value method.

Domain

Limits access to the cookie to the domain specified.

Path

Limits access to the cookie to the path specified.

Secure

If True, the cookie can only be accessed via secure (https) connections.

HTTPOnly

If True, the cookie can only be accessed via (https) connections.


WebResponse.Header

Header(name As String) As String

Gets or sets a response header using the specified Name. Setting a header to a blank string removes the header.


WebResponse.Reset

Reset

Resets the request object back to its original state.


WebResponse.SetCookie

SetCookie(Name As String, Value As String, Expiration As DateTime = Nil, Domain As String = ".", Path As String = "/", Secure As Boolean = False, HTTPOnly As Boolean = False)

Sets the value of the Name cookie. The Domain and Path must exactly match the values that were used to create the cookie.

Parameter

Description

Name

Name of the cookie to set so you can retrieve the value later with the Value method.

Value

A value to store on the user’s browser.

Expiration

Date after which the cookie will no longer be available.

Domain

Limits access to the cookie to the domain specified.

Path

Limits access to the cookie to the path specified.

Secure

If True, the cookie can only be accessed via secure (https) connections.

HTTPOnly

If True, the cookie can only be accessed via (http) connections.


WebResponse.Write

Write(data As String)

Adds the data to the response.

Notes

You are most likely to use this in conjunction with an including WebRequest via the WebApplication.HandleURL event handler. This event handler supplies a parameter (Response As WebResponse) that you can use to send out a reply.

Compatibility

Web projects on all supported operating systems.

See also

Object parent class; WebApplication.HandleURL event and WebRequest class.