The mgiSetCookie Tag

Tag Behavior

Use the mgiSetCookie tag to set a cookie with a specified value on a visitor's computer for later retrieval (see also mgiGetCookie).


Tag Syntax

The mgiSetCookie tag has a beginning tag with one required parameter and three optional parameters, a body, and an ending tag. The tag form is:

<mgiSetCookie name="Name" expiration="Julian Day" 
useEncryption="Yes/No" defaultValue="Text">
Cookie Value
</mgiSetCookie>

Required Parameters:

  • name - The name is the name of the cookie that is set on the visitor's computer. Cookie names must be unique.

Optional Parameters:

  • expiration - The julianDayExpiration is the julian day the cookie expires from the visitor's computer. (see mgiJulianDay)
  • useEncryption - The useEncryption parameter specifies whether the cookie value is encrypted. If the useEncryption parameter value is "Yes", then the cookie value is encrypted. If the useEncryption parameter value is "No", then the cookie value is not encrypted. The default value is "No."
  • defaultValue - The defaultValue is the value that is set if the cookie value is blank. If a default value is not specified, an empty string (blank) is set.


Example Usage and Output

<mgiSetCookie name="Customer">
<mgiPostArgument name="FirstName">
<mgiPostArgument name="LastName">
</mgiSetCookie>

In this example, a customer's information from a form submission is stored in a cookie for later retrieval.

<mgiSetCookie name="Password" useEncryption="Yes"
expiration={mgiJulianDay month="December" day="31" year="2000"}>
<mgiPostArgument name="Password">
</mgiSetCookie>

In this example, a user's password is encrypted and stored in a cookie on their machine. The cookie will expire on December 31, 2000.


Suggested Usage

  • Repeat Customer Information
  • Login Information


[Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]


[MGI Guides Main Menu] [User Guide Main Menu]