Discuss this help topic in SecureBlackbox Forum
Work with cookies
Cookies are blocks of information, that are originally sent by the server and kept on the client. Cookies are used to keep the session state, authentication information etc..
Cookies have a form of "Name=Value".
There are several ways to work with cookies in TElHTTPSClient class.
First way is to obtain cookies when they are sent by the server, using OnCookie event. You need to provide the event handler for this event and store the cookies somewhere. See the cookie format below. To send the cookie, use RequestParameters property of TElHTTPSClient class, which references an instance of TElHTTPRequestParams class. TElHTTPRequestParams class includes Cookie property, which lets you specify the cookie (see the cookie format below).
The other way is to use RequestCookies and ResponseCookies properties. RequestCookies contains the list of cookies to be sent to the server (see the cookie format below). ResponseCookies contains the list of cookies received from the server.
Each cookie is sent by the server in the following format:
NAME=VALUE; expires=DATE; path=PATH; domain=DOMAIN_NAME; secure
There can be multiple cookies sent in one server response.
The application must parse the cookies and store NAME=VALUE pairs separately as it will need them when sending the consequent requests to http://DOMAIN_NAME/PATH* The application must take care about cookie expiration date. If the date is not specified, the cookie expires with the user session (when the client application is closed).
When sending cookies, each NAME=VALUE pair must be put as a separate line of text to RequestCookies property.
If you use RequestParameters.Cookie property,
you need to put all cookies into one line of text as follows:
NAME1=OPAQUE_STRING1; NAME2=OPAQUE_STRING2 ...