Beispiel #1
0
        //Utilities
        protected string GetIncomingValue(WebCallContext context)
        {
            if (!Direction.IsSet(WebTokenDirection.Input)) //it is not input token
            {
                return(null);
            }
            switch (this.TokenType)
            {
            case WebTokenType.Cookie:
                var cookies = context.GetIncomingCookies(this.TokenName);
                if (cookies == null)
                {
                    return(null);
                }
                if (cookies.Count == 1)
                {
                    return(cookies[0].Value);
                }
                return(string.Join(";", cookies.Select(ck => ck.Value)));

            case WebTokenType.Header:
                var values = context.GetIncomingHeader(this.TokenName);
                if (values == null || values.Count == 0)
                {
                    return(null);
                }
                if (values.Count == 1)
                {
                    return(values[0]);
                }
                return(string.Join(";", values));
            }//switch
            return(null);
        }