Home > Contents > Index >
SETCOOKIE
Sets a cookie on the client.
Syntax
<SETCOOKIE NAME="COOKIE_NAME" VALUE="COOKIE_VALUE" TIMEOUT="EXPIRATION" SECURE="SECURE_VAL" [URL="URL_PATH"] [DOMAIN="DOMAIN_NAME"]/>Parameters
NAME (required)
- Name of the cookie to set.
VALUE (required)
- Value of the cookie being set.
TIMEOUT (required)
- Timeout value of cookie, in seconds. After the cookie has expired, it no longer exists.
Note
To produce a session-long cookie, set the timeout value to -1.
SECURE (required)
- Indicates whether security is set on this cookie. Possible values are "true" or "
false
".URL (optional)
- Valid URL. This value restricts the sending of the cookie from the client to this URL only.
DOMAIN (optional)
- Valid domain name. This value restricts the sending of the cookie from the client to addresses in this domain only.
Description
The
SETCOOKIE
tag sets a cookie on the client.SETCOOKIE
must appear before any tag that streams back data on the page or the cookie is not set. This is an HTTP requirement.
Note
When setting cookies it is preferable to use CookieServer rather than the SETCOOKIE tag.
Error Numbers
The possible values of
errno
include:
Value Description -202 Cannot send mail.Example
This example sets the cookie
mycookie
on the client with the valuefrank
. The cookie expires 600 seconds from the time it is created.
<SETVAR NAME="errno" VALUE="0"/> <SETCOOKIE NAME="mycookie" VALUE="frank" TIMEOUT="600" SECURE="false"/> <HTML> <HEAD> <TITLE>Set mycookie</TITLE> </HEAD> <BODY> The cookie, mycookie, has been set. </BODY> </HTML> <IF COND="IsError.Variables.errno=true"> <THEN> <!--Handle error--> </THEN> </IF>See Also
Home > Contents > Index > ![]()
Oracle XML Tag Reference
Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.