CCookie::setSecure

The CCookie::setSecure function sets the Secure attribute of the cookie.

int setSecure(
bool secure // containing the value of the Secure attribute
);



Return Type

int
Upon successful completion, zero is returned. Otherwise, a value of non-zero is returned.


Parameters

secure
A boolean value that contains the value of the Secure attribute of the cookie.


Remarks

This function sets the Secure attribute of the cookie. It indicates to the browser whether the cookie should only be sent using a secure protocol, such as HTTPS or SSL.

The default value of Secure attribute is false and the cookie is sent from the browser to the server using any protocol. If the value of Secure attribute is set to true, sent on only a secure protocol.

The CCookie::getSecure function can be used to retrieve the Secure attribute of the cookie.


See Also

CCookie, CCookie::getSecure, CResponse::addCookie, CRequest::getCookies, CRequest::getCookie

Example