Class RequestExtensions
- Namespace
- Dynamicweb.Environment
- Assembly
- Dynamicweb.Core.dll
Extension for IRequest that enables the return of strongly typed objects from the requests querystring or form.
- Inheritance
-
Request
Extensions
- Inherited Members
Methods
GetBoolean(IRequest, string)
Gets the boolean representation of the value for the given key. The value is parsed using the relevant helper API, so default values for the type might be returned.
Parameters
Returns
- bool
The value of a valid boolean object (
key
). In all other casesfalse
.
GetDate(IRequest, string)
Gets the date representation of the value for the given key. The value is parsed using the relevant helper API, so default values for the type might be returned.
Parameters
Returns
- Date
Time DateTime.
GetDouble(IRequest, string)
Gets the double representation of the value for the given key. The value is parsed using the relevant helper API, so default values for the type might be returned.
Parameters
Returns
- double
System.Double.
GetFiles(IRequest)
Tries to get posted files from the
Parameters
request
IRequest
Returns
GetInt32(IRequest, string)
Gets the integer representation of the value for the given key. The value is parsed using the relevant helper API, so default values for the type might be returned.
Parameters
Returns
- int
System.Int32.
GetInt64(IRequest, string)
Gets the long representation of the value for the given key. The value is parsed using the relevant helper API, so default values for the type might be returned.
Parameters
Returns
- long
System.Int64.
GetString(IRequest, string)
Gets the string representation of the value for the given key. The value is parsed using the relevant helper API, so default values for the type might be returned.
Parameters
Returns
- string
System.Int64.
HasRequest(IRequest, string)
Determines whether the specified key exists in the request.
Parameters
Returns
- bool
true
if the specified key has request; otherwise,false
.
TryGetBoolean(IRequest, string, out bool)
Tries to retrieve the boolean value associated with the specified key from querystring of the request.
Parameters
request
IRequestThe request.
key
stringThe key of the value to retrieve.
value
boolWhen this method returns, contains the boolean value associated with the specified key, if the key is found and the value can be parsed as a boolean; otherwise, the default value for the type.
Returns
- bool
true
if the key was found and the value was successfully retrieved and parsed as a boolean; otherwise,false
.
TryGetDate(IRequest, string, out DateTime)
Tries to retrieve the date value associated with the specified key from the querystring of the request.
Parameters
request
IRequestThe request.
key
stringThe key of the value to retrieve.
value
DateTime When this method returns, contains the date value associated with the specified key, if the key is found and the value can be parsed as a date; otherwise, the default value for the type.
Returns
- bool
true
if the key was found and the value was successfully retrieved and parsed as a date; otherwise,false
.
TryGetDouble(IRequest, string, out double)
Tries to retrieve the double value associated with the specified key from querystring of the request.
Parameters
request
IRequestThe request.
key
stringThe key of the value to retrieve.
value
doubleWhen this method returns, contains the double value associated with the specified key, if the key is found and the value can be parsed as a double; otherwise, the default value for the type.
Returns
- bool
true
if the key was found and the value was successfully retrieved and parsed as a double; otherwise,false
.
TryGetInt32(IRequest, string, out int)
Tries to retrieve the integer value associated with the specified key from querystring of the request.
Parameters
request
IRequestThe request.
key
stringThe key of the value to retrieve.
value
intWhen this method returns, contains the integer value associated with the specified key, if the key is found and the value can be parsed as an integer; otherwise, the default value for the type.
Returns
- bool
true
if the key was found and the value was successfully retrieved and parsed as an integer; otherwise,false
.
TryGetInt64(IRequest, string, out long)
Tries to retrieve the integer value associated with the specified key from querystring of the request.
Parameters
request
IRequestThe request.
key
stringThe key of the value to retrieve.
value
longWhen this method returns, contains the integer value associated with the specified key, if the key is found and the value can be parsed as an integer; otherwise, the default value for the type.
Returns
- bool
true
if the key was found and the value was successfully retrieved and parsed as an integer; otherwise,false
.
TryGetString(IRequest, string, out string?)
Tries to retrieve the value associated with the specified key from querystring of the request.
Parameters
request
IRequestThe collection to retrieve the value from.
key
stringThe key of the value to retrieve.
value
stringWhen this method returns, contains the value associated with the specified key, if the key is found; otherwise,
null
.
Returns
- bool
true
if the key was found and the value was successfully retrieved; otherwise,false
.