Sitecore 5.0 API

MainUtil.GetRequestFlag Method 

Gets a boolean flag from the query string.

[Visual Basic]
Public Shared Function GetRequestFlag( _
   ByVal sName As String, _
   ByVal bDefault As Boolean _
) As Boolean
[C#]
public static bool GetRequestFlag(
   string sName,
   bool bDefault
);

Parameters

sName
The name of the query string parameter.
bDefault
A default value.

Return Value

The flag as a boolean.

Remarks

A query string flag is a parameter whose value is either "1" or "0", e.g. http://www.mysite.net/?myflag=1. The default value is returned if the flag is not present on the query string.

Example

  bool flag = MainUtil.GetRequestFlag("myflag", false);

See Also

MainUtil Class | Sitecore Namespace