Class

# WebResponse

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

The response to a `WebRequest</api/web/webrequest>`.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                             | Type                                | Read-Only | Shared |
|----------------------------------|-------------------------------------|-----------|--------|
| `File<webresponse.file>`         | `FolderItem</api/files/folderitem>` |           |        |
| `MIMEType<webresponse.mimetype>` | `String</api/data_types/string>`    |           |        |
| `Status<webresponse.status>`     | `Integer</api/data_types/integer>`  |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                   | Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | Returns                          | Shared |
|----------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------|--------|
| `ClearCookie<webresponse.clearcookie>` | name As `String</api/data_types/string>`, domain As `String</api/data_types/string>` = ".", path As `String</api/data_types/string>` = "/", secure As `Boolean</api/data_types/boolean>` = `False</api/language/false>`, httpOnly As `Boolean</api/data_types/boolean>` = `False</api/language/false>`, sameSite As `WebCookieManager.SameSiteStrength<webcookiemanager.samesitestrength>` = `WebCookieManager.SameSiteStrength.Lax<webcookiemanager.samesitestrength>`                                                                                                                           |                                  |        |
| `Header<webresponse.header>`           | name As `String</api/data_types/string>`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | `String</api/data_types/string>` |        |
|                                        | name As `String</api/data_types/string>`, `Assigns</api/language/assigns>` value As `String</api/data_types/string>`                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |                                  |        |
| `Reset<webresponse.reset>`             |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                  |        |
| `SetCookie<webresponse.setcookie>`     | name As `String</api/data_types/string>`, value As `String</api/data_types/string>`, expiration As `DateTime</api/data_types/datetime>` = `Nil</api/language/nil>`, domain As `String</api/data_types/string>` = ".", path As `String</api/data_types/string>` = "/", secure As `Boolean</api/data_types/boolean>` = `False</api/language/false>`, httpOnly As `Boolean</api/data_types/boolean>` = `False</api/language/false>`, sameSite As `WebCookieManager.SameSiteStrength<webcookiemanager.samesitestrength>` = `WebCookieManager.SameSiteStrength.Lax<webcookiemanager.samesitestrength>` |                                  |        |
| `Write<webresponse.write>`             | data As `String</api/data_types/string>`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |                                  |        |

## Property descriptions

<div id="webresponse.file">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebResponse.File

**File** As `FolderItem</api/files/folderitem>`

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

<div id="webresponse.mimetype">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebResponse.MIMEType

**MIMEType** As `String</api/data_types/string>`

> Gets or sets the HTTP "Content-Type" header.
>
> The default value is "text/html".

<div id="webresponse.status">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebResponse.Status

**Status** As `Integer</api/data_types/integer>`

> Gets or sets the HTTP response status.
>
> 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](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html).

## Method descriptions

<div id="webresponse.clearcookie">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebResponse.ClearCookie

**ClearCookie**(name As `String</api/data_types/string>`, domain As `String</api/data_types/string>` = ".", path As `String</api/data_types/string>` = "/", secure As `Boolean</api/data_types/boolean>` = `False</api/language/false>`, httpOnly As `Boolean</api/data_types/boolean>` = `False</api/language/false>`, sameSite As `WebCookieManager.SameSiteStrength<webcookiemanager.samesitestrength>` = `WebCookieManager.SameSiteStrength.Lax<webcookiemanager.samesitestrength>`)

> Clears all data from the cookie at the location specified. If you use `SameSiteStrength.Lax<webcookiemanager.samesitestrength>`, secure will always be `True</api/language/true>`, regardless of what you enter.
>
> | 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</api/language/true>`, the cookie can only be accessed via secure (https) connections.                                                                                                                                                                                                           |
> | httpOnly  | If `True</api/language/true>`, the cookie can only be accessed via (https) connections.                                                                                                                                                                                                                  |
> | sameSite  | Defines the context in which the cookies are sent by the browser to the server. The default value None means cookies are sent in all contexts. With Lax, cookies are not sent on normal cross-site subrequests (images or frames to a 3rd party site). With Strict cookies are only sent to your server. |

<div id="webresponse.header">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebResponse.Header

**Header**(name As `String</api/data_types/string>`) As `String</api/data_types/string>`

**Header**(name As `String</api/data_types/string>`, `Assigns</api/language/assigns>` value As `String</api/data_types/string>`)

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

<div id="webresponse.reset">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebResponse.Reset

**Reset**

> Resets the request object back to its original state.

<div id="webresponse.setcookie">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebResponse.SetCookie

**SetCookie**(name As `String</api/data_types/string>`, value As `String</api/data_types/string>`, expiration As `DateTime</api/data_types/datetime>` = `Nil</api/language/nil>`, domain As `String</api/data_types/string>` = ".", path As `String</api/data_types/string>` = "/", secure As `Boolean</api/data_types/boolean>` = `False</api/language/false>`, httpOnly As `Boolean</api/data_types/boolean>` = `False</api/language/false>`, sameSite As `WebCookieManager.SameSiteStrength<webcookiemanager.samesitestrength>` = `WebCookieManager.SameSiteStrength.Lax<webcookiemanager.samesitestrength>`)

> Sets the value of the *name* cookie. The *domain* and *path* must exactly match the values that were used to create the cookie. If *sameSite* is set to `SameSiteStrength.Lax<webcookiemanager.samesitestrength>`, secure will always be `True</api/language/true>`, regardless of what you've entered.
>
> | 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</api/language/true>`, the cookie can only be accessed via secure (https) connections.                                                                                                                                                                                                           |
> | httpOnly   | If `True</api/language/true>`, the cookie can only be accessed via (http) connections.                                                                                                                                                                                                                   |
> | sameSite   | Defines the context in which the cookies are sent by the browser to the server. The default value None means cookies are sent in all contexts. With Lax, cookies are not sent on normal cross-site subrequests (images or frames to a 3rd party site). With Strict cookies are only sent to your server. |

<div id="webresponse.write">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebResponse.Write

**Write**(data As `String</api/data_types/string>`)

> Adds the *data* to the response.

## Notes

You are most likely to use this in conjunction with an including `WebRequest</api/web/webrequest>` via the `WebApplication.HandleURL<webapplication.handleurl>` event handler. This event handler supplies a parameter (Response As <span class="title-ref">WebResponse</span>) that you can use to send out a reply.

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | Web |
| **Operating Systems** | All |

<div class="seealso">

`Object</api/data_types/additional_types/object>` parent class; `WebApplication.HandleURL<webapplication.handleurl>` event and `WebRequest</api/web/webrequest>` class.

</div>
