|
|||||
|
||||||
Related Syntax | Other Library Functions |
function |
HttpObjectSetCookieAttribute |
Library: HTTP support (OMHTTP)
Include: omhttp.xin |
define function HttpObjectSetCookieAttribute modifiable stream HttpObject for value stream CookieName attribute value stream AttrName to value stream AttrValue
Argument definitions
Use HttpObjectSetCookieAttribute to set a named attribute value for a cookie header in an HTTP request or response object.
You must include the following line at the beginning of your OmniMark program:
include "omhttp.xin"
If a nonexistent cookie name is specified, the HTTP object will be in error. Usually, HttpObjectSetCookieAttribute
is called in a server program.
Set both request and response cookie attributes.
; HttpObjectSetCookieAttribute include "omhttp.xin" process local HttpRequest my-Request local HttpResponse my-Response HttpObjectSetCookieAttribute my-Request for "DocUserID" attribute "Domain" to "www.stilo.com" HttpObjectSetCookieAttribute my-Response for "DocUserID" attribute "Domain" to "www.stilo.com"
Create a function to set cookie attributes.
include "omhttp.xin" define function SetUserIdCookie (modifiable stream http-object, value stream cookie-name, value stream cookie-value, value stream user-id) as HttpObjectSetCookieValue http-object for cookie-name to user-id HttpObjectSetCookieAttribute http-object for cookie-name attribute "Domain" to "www.stilo.com" HttpObjectSetCookieAttribute http-object for cookie-name attribute 'Path' to '/'
The following line calls the above function:
SetUserIdCookie(my-http-object, cookie-name, cookie-value, user-id)
Copyright © Stilo International plc, 1988-2008.