Riverwatcher Active Content Environment

RACE Documentation:


RACE Documentation - Define Cookies DEFINE - Cookies - Defining cookies in RACE.



  • COOKIE - The name of the cookie
  • DOMAIN - This attribute allows you to specify the domain for which the cookie is valid. If not specified, the default domain will be that of the page being executed.
  • PATH - This attribute allows you to specify the path for which the cookie is valid. If not specified, the default path will be that of the page being executed.
  • EXPIRES - This attribute determines when a cookie will expire. If not specified, the cookie will expire when the browser closes. RACE has a parser to simplify choosing an expiration date, and accepts strings such as: "1 year", "2 months", "3 days", "4 hours", "5 minutes", "6 seconds", or any combination thereof separated by spaces. Also see the COOKIE attribute of the DATE tag syntax for additional syntatical sugar.
  • SECURE - If SECURE is specified, the cookie will only be transmitted if the browser is using SSL.
Note: A live demonstration of executing code is not possible on this single page, since a cookie will not "appear" until a page is loaded AFTER it is defined. Therefore, the examples and outputs below are simulated:

Example - Defining and accessing a simple cookie
Source:

<define cookie="testusername">Bob</define>

<$cookies.testusername>

Output:
Bob


Example - Defining and accessing a secure cookie that expires in 1 hour and is only accessible in a certain path
Source:

<define cookie="loggedin" path="/membersonly" expires="1 hour" secure>true</define>

<$cookies.loggedin>

Output:
true



note: In this case, the output of "true" would only occur if the client was viewing something
in the /membersonly path via a secure connection, and the cookie had not expired (in this case, it
would expire in one hour).




RACE Documentation



 
Copyright 2009 Riverwatcher, Inc. Hosting by Riverwatcher Studios