cleans up a bit of code relating to U4-1412

This commit is contained in:
Shannon Deminick
2013-01-10 05:55:55 +03:00
parent 08859c3b32
commit 8ed1d76bc7
3 changed files with 10 additions and 7 deletions

View File

@@ -16,8 +16,9 @@ namespace Umbraco.Web
/// </summary>
/// <param name="request"></param>
/// <param name="key"></param>
/// <param name="valueIfNotFound">The value to return if the key is not found in the collection</param>
/// <returns></returns>
public static string GetItemAsString(this HttpRequest request, string key)
public static string GetItemAsString(this HttpRequest request, string key, string valueIfNotFound = "")
{
return new HttpRequestWrapper(request).GetItemAsString(key);
}
@@ -27,11 +28,12 @@ namespace Umbraco.Web
/// </summary>
/// <param name="request"></param>
/// <param name="key"></param>
/// <param name="valueIfNotFound">The value to return if the key is not found in the collection</param>
/// <returns></returns>
public static string GetItemAsString(this HttpRequestBase request, string key)
public static string GetItemAsString(this HttpRequestBase request, string key, string valueIfNotFound = "")
{
var val = HttpContext.Current.Request[key];
return !val.IsNullOrWhiteSpace() ? val : string.Empty;
return !val.IsNullOrWhiteSpace() ? val : valueIfNotFound;
}
/// <summary>