ISML Tag - ISCOOKIE

Product Version

6.5

Product To Version

 

Statusfinal

1 Introduction

<ISCOOKIE> is used to set a cookie in your system. A cookie is a message given to the web browser by the Intershop 7 system. A cookie allows you to store user-related information on the buyer's system, such as storefront preferences for a single buyer. Cookies can also be used to simplify the login procedure, so buyers don't have to type in their names and passwords each time they access the storefront. To accomplish this, the cookie would store a unique user ID on the buyer's system. After the cookie is stored, the browser returns it every time the buyer requests the URL of the issuing server.

2 Syntax

<ISCOOKIE
name = "( {String} | {ISML expression} )"
value = "( {String} | {ISML expression} )"
[ comment = "( {String} | {ISML expression} )" ]
[ domain = "( {String} | {ISML expression} )" ]
[ path = "( {String} | {ISML expression} )" ]
[ maxAge = "( {String} | {ISML expression} )" ]
[ version = "( {String} | {ISML expression} )" ]
[ secure = "( on | off )" ]
>

You can use the following functions to retrieve additional data:

  • Use the getCookie() function to read the cookie sent back by the client.
  • Use the getCookie() function to return the value of a request header field of the current request.

3 Example

The following example shows how to set a cookie that can be used later to identify a customer:

<ISCOOKIE
name = "UserID"
value = "#Buyer:UUID#"
comment = "your international customer ID"
domain = ".foo.com"
path = "/acme"
maxAge = "10000"
version = "0"
secure = "on"
>

The following example shows how to use a cookie that has been sent with the current request.

<ISIF condition = "#isdefined(getCookie("UserID"))#">
  <ISREDIRECT location="#URL(Action('LoginPanel'))#">
</ISIF>

4 Attributes

4.1 name

This attribute is required.

name = string | ISML expression

Specifies a name for the cookie. Names starting with "$" are not allowed.

4.2 value

This attribute is required.

value = string | ISML expression

Specifies the value that should be stored by the cookie, e.g., a user ID.

4.3 comment

This attribute is optional.

comment = string | ISML Expression

Allows you to document the intended use of the cookie. For example, if a cookie contains private information about a user, use the comment attribute to mark the cookie accordingly. The user can then inspect the information to decide whether to accept the cookie or not.

4.4 domain

This attribute is optional.

domain = String | ISML Expression

Specifies the domain for which the cookie is valid. An explicitly specified domain must always start with a dot. If not specified, the browser will set the attribute domain to the domain that issues the cookie.

4.5 oath

This attribute is optional.

path = String | ISML expression

Specifies the subset of URLs to which this cookie applies. Pages outside of that path cannot use the cookie.

4.6 maxAge

This attribute is optional.

maxAge = String | ISML expression

Defines the lifetime of the cookie in seconds. After the specified time elapses, the buyer's browser can discard the cookie. A value of zero means the cookie can be discarded immediately.

4.7 version

This attribute is optional.

version = String | ISML expression

Identifies the version of the specification which the cookie conforms to. The default value is 0.

4.8 secure

This attribute is optional.

secure = on | off

The secure attribute is a flag indicating that a cookie should only be used with a secure server, such as SSL. Default value is off.

Reference - ISML Tags

Disclaimer

The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.

Customer Support
Knowledge Base
Product Resources
Support Tickets