Equinox Online Help - Language Reference - A to Z

Home

WebSetCookie

Applies to
SyntaxWebSetCookie name, value, expiryDate, expiryTime, path, domain, secure
WebSetCookie string, string[, date, time, string, string, int]
Action[statement] sets a cookie for a realm.
ScopeUsed in method language on an ESP page.
Notes

Cookies must be set individually but you can have multiple instances of the WebSetCookie statement being used on a web page or within a web site.

The use of the 'date' in this statement determines if the cookie is a session cookie (no date supplied) or a persistent cookie (date supplied).

As cookies may be the basis of the log on process it is important to distinguish between the two types.

SysErrors:

  • 1 Buffering is not enabled
  • 2 The cookie has an invalid name
  • 3 The cookie has an invalid value
  • 4 Broken security rules
  • 5 Internal error
  • 6 The cookie was properly formed but there was trouble storing it in a header file.

Path - The path attribute is used to specify the subset of URLs in a domain for which the cookie is valid. If a cookie has already passed domain matching, then the pathname component of the URL is compared with the path attribute, and if there is a match, the cookie is considered valid and is sent along with the URL request. The path "/doc" would match "/documents" and "/docs/files.html". The path "/" is the most general path.

Domain - When searching the cookie list for valid cookies, a comparison of the domain attributes of the cookie is made with the Internet domain name of the host from which the URL will be fetched.

The default value of domain is the host name of the server which generated the cookie response.

Secure - If a cookie is marked secure, it will only be transmitted if the communications channel with the host is a secure one. If secure is not specified, a cookie is considered safe to be sent in the clear over unsecured channels

CategoryWeb Server
See Also WebBaseDirectory, WebCurrentPage, WebGetCookies, WebGetHeader, WebOutput, WebOutputFile, WebParameter, WebPostData, WebRedirect, WebSetHeader
Example

This example sets a cookie called Football with a value of 'fans'

WebSetCookie "football", "fans"

This example sets a cookie called Equinox with a value of “Tom”. It is set to expire on 01/01/2005 and assuming the domain “Compsoft” has been matched with the requesting page, the cookie can be set for any page found in any sub folder of the “/WebPages” folder. As the secure settings is set to true, the cookie will only be set if a secure page is being transmitted.

WebSetCookie "Equinox", "Tom", "01/01/2005", , "/WebPages", "Compsoft", "1"