WebSetSecurity Function

Action

Sets the security mode to use when exchanging data with a remote server. This function is very practical to switch programmatically between secure an insecure mode without the need to modify any other function calls.

注: This function overrides the corresponding setting in the Security tab of the Profile Settings - Internet dialog.

Include file

WebAPI.bdh

Syntax

WebSetSecurity(in nSecurity: number): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
nSecurity

Value can assume one of the following:

  • WEB_SECURITY_NONE. Disables the use of security

  • WEB_SECURITY_SSL. Enables the use of SSL for all protocols except FTP

Example

dcltrans
  transaction TWebSecure
  begin
    WebUrl("http://standardhost/gmo/products.htm", 5.45);
    WebSetSecurity(WEB_SECURITY_SSL);
    WebUrl("http://standardhost/gmo/images/backpack.gif", 0.01);
    WebUrl("http://standardhost/gmo/images/boots.gif", 5.28);
    WebUrl("http://standardhost/gmo/products.htm", 9.06);
    WebSetSecurity(WEB_SECURITY_NONE);
    WebUrl("http://standardhost/gmo/images/socks.gif", 0.11);
    WebUrl("http://standardhost/gmo/images/shorts.gif", 0.19);
    // This URL always is requested through SSL due to HTTPS scheme
    WebUrl("https://standardhost/gmo/index.html", 0.45);
  end TWebSecure;

Sample scripts

WebSecure01.bdf, WebSecure02.bdf