Used to save a cookie.
This function returns 0 if the result is correct, and if there was an error it returns any other value.
The parameters between brackets are optional and if any of the parameters are null, the default is assumed.
SetCookie( Name, Value [, Path] [, Exp-date] [, Domain-name][, Secure])
Is the cookie's name and it is a character type.
Is the value to be stored and it is a character type.
The value will be encoded before sending to the browser
Is the Path that indicates the web panels for which the cookie is valid, and it is also a character type. If it isn’t specified, the cookie is valid for the web panels that are in the same directory as the one it is stored in, or in subordinated directories. If “/” is indicated, the cookie will be valid for the entire domain.
Indicates the expiration date of the cookie. It is a date/datetime type. If it isn’t specified, it will expire when the session is closed in the browser.
Is the domain where the cookie is valid. It is a character type. The default domain is the domain where it has been created.
Is a numeric type. If it is 1, the cookie is transmitted only if the connection is secure (HTTPS). If it is 0, it is always transmitted.
Below are some simple examples of how to store cookies.
&Op = SetCookie('ID_USER', Str(UsrId), '/', CTOD('01/01/2010') )
Here a cookie named ID_USER is being stored. It is valid for the entire domain and its value corresponds to the UsrId attribute, which will expire January 1st, 2010.
&OK = SetCookie('SESSION_ID_GX', &StrSession, '', Nullvalue(&Date) )
Here a cookie named SESSION_ID_GX is being stored. It is valid for the application's web panels and its value corresponds to the &Strsession variable. This cookie will expire when the browser is closed.
&Op = SetCookie('USR_CTRY', 'UY', '/', ADDYR(&Today, 1), 'otherdom.artech.com.uy', 1)
Here a cookie named USR_CTR is being stored. It is valid for the ‘otherdom’ domain and its value, UY, will expire exactly one year from today.