The CResponse::addCookie function adds a specified cookie with attributes, such as MaxAge, Path, Domain and Secure, to a client.
CCookie * cookie // points to an object of CCookie
Upon successful completion, zero is returned. Otherwise, a value of non-zero is returned.
A pointer that points to an object of CCookie which contains the information of the cookie to be added.
This function adds a specified cookie with attributes such as MaxAge, Path, Domain and Secure to a client. The CRequest::getCookie function retrieves a cookie by name, while the CRequest::getCookies function retrieves all of cookies.
This function shall be called before member function CResponse::begin is called.
Properties of Name, Value, MaxAge, Path, Domain and Secure are supported by cookies which comply with Netscape Cookie specifications version 0 and RFC 2965 new version 1. Properties of Discard, Comment, CommentURL, portList and version are supported only by cookies which comply with RFC 2965 new version 1. Because there is no browser to support the cookie complying with RFC 2965 new version 1 as yet, these properties are not recommended to use.
Differences Between Ch-CGI and Ch-ASP
In Ch-ASP, this function can add a cookie with properties of only Name, Value, Path, Domain, MaxAge and Secure.
In Ch-CGI, it can add a cookie with all properties of Name, Value, Path, Domain, MaxAge, Secure, Discard, Version, Comment and CommentURL and portList.
CResponse, CCookie, CRequest::getCookies, CRequest::getCookie