SetCookie Method  

Send the specified cookie to the server when a resource is requested.


object.SetCookie( CookieName, CookieValue )


A string which specifies the name of the cookie that is to be sent to the server when the next resource is requested.
A string which specifies the value of the cookie. To delete a cookie that has been previously set, this parameter should be an empty string.

Return Value

This method returns a Boolean value. A value of true is returned if the cookie has been set. Otherwise, a value of false is returned, which indicates that the cookie could not be created.


The SetCookie method submits the cookie name and value to the server when a resource is requested or data is posted to a script. For more information about cookies and how they are used, refer to the GetCookie method.

See Also

CookieCount Property, CookieName Property, CookieValue Property, ClearHeaders Method, GetCookie Method