ServiceStack.HttpRequestExtensions.GetParam C# (CSharp) Метод

GetParam() публичный статический Метод

Gets request paramater string value by looking in the following order: - QueryString[name] - FormData[name] - Cookies[name] - Items[name]
public static GetParam ( this httpReq, string name ) : string
httpReq this
name string
Результат string
        public static string GetParam(this IRequest httpReq, string name)
        {
            string value;
            if ((value = httpReq.Headers[HttpHeaders.XParamOverridePrefix + name]) != null) return value;
            if ((value = httpReq.QueryString[name]) != null) return value;
            if ((value = httpReq.FormData[name]) != null) return value;

            //IIS will assign null to params without a name: .../?some_value can be retrieved as req.Params[null]
            //TryGetValue is not happy with null dictionary keys, so we should bail out here
            if (IsNullOrEmpty(name)) return null;

            Cookie cookie;
            if (httpReq.Cookies.TryGetValue(name, out cookie)) return cookie.Value;

            object oValue;
            if (httpReq.Items.TryGetValue(name, out oValue)) return oValue.ToString();

            return null;
        }