Page.RequestDefault Method

The RequestDefault method retrieves a value from a URL query string or form post variable and returns the value as a string.

Syntax

Page.RequestDefault(Name, Default)

Parameters

Name
The name of the URL query string variable to retrieve.
Default
Optional. The value to return if the requested URL query string or form post variable contains an empty string or a Null, or is not present in the request string. If this parameter is not supplied, the method returns Null in this case.

Remarks

This method is designed so that if a field on a form is blank, or the form does not contain the field, the value returned by default is Null. Null is generally the appropriate value to store to a database when a value is not present. If you need the result to be an empty string in the case of a missing value, supply an empty string as the Default parameter, as in the following example:

Page.RequestDefault("shopper_phone", "")

Example

The following example attempts to retrieve the value for the URL query string variable shopper_phone. Because no Default argument is supplied, if this URL query string variable has no value, the call to RequestDefault returns Null:

shopper_phone = Page.RequestDefault("shopper_phone")

Related Topics


© 1997-1998 Microsoft Corporation. All rights reserved.