View Source
Class HttpRequestExtensions
Extension methods for the HttpRequest and HttpRequestBase objects
Inheritance
System.Object
Assembly: Umbraco.Web.dll
Syntax
public static class HttpRequestExtensions
Methods
View Source
CleanForXss(HttpRequest, String, String)
Extracts the value from the query string and cleans it to prevent xss attacks.
Declaration
public static string CleanForXss(this HttpRequest request, string key, string valueIfNotFound = "")
Parameters
Type |
Name |
Description |
System.Web.HttpRequest |
request |
|
System.String |
key |
|
System.String |
valueIfNotFound |
|
Returns
Type |
Description |
System.String |
|
View Source
GetItemAs<T>(HttpRequest, String)
Safely get the item from the query string and convert it to type 'T', otherwise will return default(T).
Declaration
public static T GetItemAs<T>(this HttpRequest request, string key)
Parameters
Type |
Name |
Description |
System.Web.HttpRequest |
request |
|
System.String |
key |
|
Returns
Type Parameters
View Source
GetItemAs<T>(HttpRequestBase, String)
Safely get the item from the query string and convert it to type 'T', otherwise will return default(T).
Declaration
public static T GetItemAs<T>(this HttpRequestBase request, string key)
Parameters
Type |
Name |
Description |
System.Web.HttpRequestBase |
request |
|
System.String |
key |
|
Returns
Type Parameters
View Source
GetItemAsString(HttpRequest, String, String)
Safely get a request item as string, if the item does not exist, an empty string is returned.
Declaration
public static string GetItemAsString(this HttpRequest request, string key, string valueIfNotFound = "")
Parameters
Type |
Name |
Description |
System.Web.HttpRequest |
request |
|
System.String |
key |
|
System.String |
valueIfNotFound |
The value to return if the key is not found in the collection
|
Returns
Type |
Description |
System.String |
|
View Source
GetItemAsString(HttpRequestBase, String, String)
Safely get a request item as string, if the item does not exist, an empty string is returned.
Declaration
public static string GetItemAsString(this HttpRequestBase request, string key, string valueIfNotFound = "")
Parameters
Type |
Name |
Description |
System.Web.HttpRequestBase |
request |
|
System.String |
key |
|
System.String |
valueIfNotFound |
The value to return if the key is not found in the collection
|
Returns
Type |
Description |
System.String |
|