Data Types of the iScript Classes

Cookie objects are instantiated from Response object. You can declare the cookie object as data type cookie before any functions. You can also declare variables of type Response and Request, to assign the %Response and %Request system variables to local variables.

Local Cookie &Cookie; 
Local Response &Resp; 
Local Request &Req; 
 
Function IScript_SetCookie() 
    rem set a cookie called "MyCookie" to store my user id in it's value.  
Make the cookie expire when the user's browser session expires; 
    
   &Resp = %Response; 
   &Req = %Request; 
   &Cookie = &Resp.CreateCookie("MyCookie"); 
   &Cookie.Value = %UserId; 
   &Cookie.MaxAge = -1; 
      
End-Function;