|
||||||||||
|
|
||||||||||
| Related Syntax | Other Library Functions | |||||||||
| function | HttpObjectSetCookieAttribute |
Available in:
Enterprise Professional |
|
Library: omhttp - HTTP support
Include: omhttp.xin |
define function HttpObjectSetCookieAttribute
modifiable stream HttpObject
for value stream CookieName
attribute value stream AttrName
to value stream AttrValue
where
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.omnimark.com"
HttpObjectSetCookieAttribute my-Response
for "DocUserID" attribute "Domain" to "www.omnimark.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.omnimark.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)
| ---- |