Sets a cookie.

Syntax

Smartsite SXML CopyCode image Copy Code
response.setcookie(string key, string value)
response.setcookie(string key, string value, boolean httpOnly)
response.setcookie(string key, string value, boolean httpOnly, boolean secure)
response.setcookie(string key, string value, datetime expireDate)
response.setcookie(string key, string value, datetime expireDate, string path)
response.setcookie(string key, string value, datetime expireDate, string path, boolean httpOnly)
response.setcookie(string key, string value, datetime expireDate, string path, boolean httpOnly, boolean secure)
response.setcookie(string key, string value, string path)
response.setcookie(string key, string value, string path, boolean httpOnly)
response.setcookie(string key, string value, string path, boolean httpOnly, boolean secure)

Parameters

Name Data Type Description
key String The key.
value String The value.
httpOnly Boolean The cookie is HTTP only, not visible in client script
secure Boolean A value indicating whether to transmit the cookie using Secure Sockets Layer (SSL) (that is, over HTTPS only).
expireDate DateTime The expire date for the cookie. If set, the cookie will be persistent; otherwise, it will be a session cookie
path String The cookie domain path.

Return Value

None.

Expand image Example

SXML