IsHeaderValue() static private method

static private IsHeaderValue ( string value ) : bool
value string
return bool
 private static string CheckValue(string value)
 {
     if (value.IsNullOrEmpty())
     {
         return(string.Empty);
     }
     value = value.Trim();
     if (value.Length > 65535)
     {
         throw new ArgumentOutOfRangeException("value", "The length must not be greater than 65535.");
     }
     if (!WebHeaderCollection.IsHeaderValue(value))
     {
         throw new ArgumentException("Contains invalid characters.", "value");
     }
     return(value);
 }
Example #2
0
        private static string checkValue(string value)
        {
            string empty;

            if ((value == null ? false : value.Length != 0))
            {
                value = value.Trim();
                if (value.Length > 65535)
                {
                    throw new ArgumentOutOfRangeException("value", "Greater than 65,535 characters.");
                }
                if (!WebHeaderCollection.IsHeaderValue(value))
                {
                    throw new ArgumentException("Contains invalid characters.", "value");
                }
                empty = value;
            }
            else
            {
                empty = string.Empty;
            }
            return(empty);
        }