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

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

Gets string value from Items[name] then Cookies[name] if exists. Useful when *first* setting the users response cookie in the request filter. To access the value for this initial request you need to set it in Items[].
public static GetItemOrCookie ( this httpReq, string name ) : string
httpReq this
name string
Результат string
        public static string GetItemOrCookie(this IRequest httpReq, string name)
        {
            object value;
            if (httpReq.Items.TryGetValue(name, out value)) return value.ToString();

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

            return null;
        }