Company Products Services Licensing Where-to-buy Contact



In this project the TFRISAPIResponse.AddCookie function has been used to send a cookie to the client, and the TFRISAPIRequest.CookieValue[AnsiString] property has been used to get the cookie value from the client.

In the OnDefaultRequest event of the ISAPIDispatcher1 the TfmAddCookie module is used to get the cookie information from the client. For this purpose the corresponding form includes a TFREdit named "COOC_STR" and a TFRCheckbox named "MAKE_PERS". In order to send the form data and to open a window for viewing the cookie the JavaScript function "DoAction(act,targ)" is used that sets the FRForm1 action and target attributes of the HTML FORM and calls the Submit() function. Clicking on the "Add" button sets the "newc" action and the "_self" target, clicking the "Show" button "showc" and "_blank" will be set.

aiNewCookie corresponds to the action "newc" in the OnAction event of which the AddCookie function of the TFRISAPIResponse is used to add a cookie to a response and then the OnDefaultRequest event of the ISAPIDispatcher1 is activated and the initial form is again sent to the client. If the client has marked the Checkbox "MAKE_PERS", the respective request parameter has a length other than zero when presented as string, and the client receives a cookie with current time +1 as its "expires" quality, which means that the client's browser will retain the cookie for one day. If the "MAKE_PERS" was not checked, a cookie is sent that has the "expires" quality 0 and such cookie will be deleted when the client's browser is closed.

aiShowCookie corresponds to the action "showc" in the OnAction event of which the module TfmShowCookie is used to read the value of a cookie sent earlier and show it to the client. To read the respective cookie the TFRISAPIRequest property CookieValue[AnsiString] is used in the FRStaticText1 OnTag event existing on this form.