Using InstallScript Text Substitution to Dynamically Modify IIS Settings

InstallShield 2020

Project:This information applies to InstallScript projects.

For InstallScript projects, you can configure an IIS setting dynamically at run time through the use of text substitution string variables. This enables you to let end users specify the name of the virtual directory, the TCP port, the site number, or other IIS settings for the Web sites, applications, virtual directories, application pools, and Web service extensions that they are installing on the target machine. The InstallScript run-time code uses the TextSubSubstitute function to replace the string variable with the appropriate value.

Example

The following procedure demonstrates how to let end users specify during installation the user name used for anonymous access to the Web site. Note that you can substitute a hard-coded value with a text substitution string variable for any of the IIS settings in the Internet Information Services view that allow you to enter characters. The string variable that you specify in this view must be enclosed within angle brackets; for example, <MYPROPERTY>. The string variable that you specify is case-sensitive.

To let end users specify the user name:

1. In the View List under Server Configuration, click Internet Information Services.
2. In the Web Sites explorer, click the Web site whose user name end users should be able to specify for anonymous access.
3. For the Enable anonymous access setting, select Yes.
4. In the Anonymous User Name setting, type the following:

<MYPROPERTY>

5. In the View List under Behavior and Logic, click InstallScript.
6. Find the dialog code in the OnFirstUIBefore event for the dialog that should contain the User Name control, and add a call to the InstallScript function TextSubSetValue. For example, if you want the user name to be the name that the end user specifies on the CustomerInformation dialog, you would add a TextSubSetValue call as shown in the following lines of code:

Dlg_SdRegisterUser:

    szMsg = "";

    szTitle = "";

    //{{IS_SCRIPT_TAG(Dlg_SdRegisterUser)

    nResult = SdRegisterUser( szTitle, szMsg, szName, szCompany );

    TextSubSetValue("<MYPROPERTY>", szName, TRUE);

    //}}IS_SCRIPT_TAG(Dlg_SdRegisterUser)

    if (nResult = BACK) goto Dlg_SdLicense2;

7. Build your release.

See Also