The setcookie statement set the value of a cookie to send back to the client..
Parameters
This statement has four parameters:cookie – Name of cookie value. Must be only ASCII letters and numbers (no spaces, no punctuation, no Unicode values).
value – data value of cookie (numeric or date values will be converted to text.
expires – cookie expiration time. If not specified, the cookie will expire when the user quits the browser. If all numeric digits (or a number) it expires after specified number of seconds. You may also add a suffix: seconds, minutes, hours, days, weeks, months, years.
options – additional cookie options (see http://www.ietf.org/rfc/rfc2965.txt page 4)
Description
This statement may be used in web procedure code to return a cookie value to the broswer. The browser will send this value back to the server each time it makes a request.
setcookie "SalesTax","8.25"
setcookie "TableFontPref","Verdana"
setcookie "MyAreaCode","858"
Later, another web procedure can read these values using the getcookie( function.
let areaCode = getcookie("MyAreaCode")
Note: Cookie names are not case sensitive, so MyAreaCode, MYAREACODE and myareacode all refer to the same value.
Cookies don’t last forever. In fact, if you don’t specify an expiration date for a cookie then it will disappear when the user closes the browser window. If you want to keep a cookie around for a while set an expiration date for it, like this:
setcookie "SalesTax","8.25","12 hours"
setcookie "TableFontPref","Verdana","12 weeks"
setcookie "MyAreaCode","858","12 years"
The cookie expiration time can be speified in seconds, minutes, days, weeks, months or years.
This optional parameter allows you to add more options to the cookie. The best source of information we’ve found for additional cookie options is at http://www.ietf.org/rfc/rfc2965.txt, however, please note that the Panorama Server uses the original cookie format, not version 2 (it appears that the version of Apache shipped with MacOS does not support version 2 cookies). In general you probably don’t need to worry about these extra options.
See Also
History
Version | Status | Notes |
10.2 | Updated | Carried over from Panorama 6. |