Using Flexible URL Parameters
7. Click on the Test button in the ribbon to test the e-script The web page called now shows the current values of the CFID and CFTOKEN parameters.
Options for defining parameters in URLs:
The method outlined above for making parameters flexible involved straight replacements. We double- clicked to open parameter properties and replaced the values for login with the predefined HAN variables for user ID and password. Your HAN system also lets you replace a random value with a variable that is not bound to a particular purpose. You can replace not only parameter values, but also session IDs in URLs with variables.
HAN can replace a value with a variable only if HAN recognizes the value. Some web pages, however, contain parameters in hidden form fields. A common example is the "_Viewstate" parameter used in ASP pages. If a variable is used to send data over HAN to the origin server (using the POST method), HAN sends the wrong value. Solution: Use the GET method to call the web page first, and then use POST to send the variable defined for the value.
Parameter used for login:
Double-click to open parameter properties and replace the login values with the predefined HAN variables, _HANURL_USER_ for the user ID and _HANURL_PASSWORD_ for the password. The Parameters field under "Define how the parameter is used in the script" offers the following options:
has a predefined value. The value for this parameter is predefined and does not change. It is passed "as is" to resource provider's server.
is used for login - user (_HANURL_USER_). The parameter is for the login name; the value is replaced by the predefined HAN variable for the login name, _HANURL_USER_.
the value is replaced by the predefined HAN variable for the password, _HANURL_PASSWORD_.
Example: We shall create an e-script for a fictitious online resource which we shall call
"onlinejournal.com". This site requires user authentication with user name and password. It also has a hidden form field (__VIEWSTATE):
The two values in the parameters for login credentials are replaced by variables as described above. The value for the __VIEWSTATE parameter is made flexible by using an unbound variable. For details on using flexible values for this type of parameter, see "Parameter has a random value". The script still fails to execute, however, because HAN cannot detect the current value of the __VIEWSTATE parameter. If the /home.aspx page is loaded separately beforehand using the GET method, HAN can read the HTML code and detect the required parameters:
has a predefined value. The value for this parameter is predefined and does not change. It is passed "as is" to resource provider's server.
may contain different values - replace only if parameter name and value are identical. HAN replaces the value in all instances in which this parameter name is paired with this exact value. may contain different values - replace only if values are identical. HAN replaces the value in all instances in which it is found, regardless of the parameter in which it is stored. In the Replace in field, define the position in which the value is to be replaced.
Replace if parameter names and values are identical:
To have HAN replace the values for the selected parameter in every instance in which the specified parameter has the specified value, select may contain different values - replace only if
parameter name and value are identical in the Parameter field. In the Value field, the value is automatically replaced by a variable:
Replace only if values are identical:
With this option, HAN replaces the value of the selected parameter even when it is found in a different position, e.g. within a URL or as a component of a value in a different parameter. Only the value itself must match the selection. With this option selected, you need to define in the Replace in field just where the value is to be replaced. Otherwise, only the currently selected Parameter value will be made flexible. Furthermore, a separator for the parameter must be specified. Select may contain
different values - replace only if values are identical in the Parameter field. In the Value field, the value is automatically replaced by a variable. Under Replace in, put checkmarks in the checkboxes as needed, depending on where you wish to have additional identical values replaced. Enter the separator in the field next to the parameters; with separator:
Example: The home page of our fictitious online magazine, "onlinemag.com," shows their latest issue. Thus the content on this page changes regularly. The script that calls this resource appears as follows in the Script Editor:
The parameters for login have already been replaced with variables, and the script is fully functional. The page it opens, however, always shows the issue that was current when the e-script was created,
Under Replace in select "the parameters" and enter / as the separator. You do not need to select the URL, because there is no value from the "isbn" parameter in the URLs. With these settings selected, HAN replaces all parameter values that match the isbn parameter value – throughout the entire script. Once all variables have been added, the script appears as follows in the Script Editor:
Replacing a session ID in a URL:
In some cases, the session ID is not appended to the URL, but rather is a fixed part of the URL itself. With HAN, you can replace this URL section if desired. Here is an example: