Exemple #1
0
        void EncodeAndSetHeader(string name, string value, bool replaceExisting)
        {
            if (String.IsNullOrEmpty(name) || String.IsNullOrEmpty(value))
            {
                return;
            }

            string encName, encValue;

            if (HeaderCheckingEnabled)
            {
#if NET_4_0
                HttpEncoder.Current.HeaderNameValueEncode(name, value, out encName, out encValue);
#else
                HttpEncoder.HeaderNameValueEncode(name, value, out encName, out encValue);
#endif
            }
            else
            {
                encName  = name;
                encValue = value;
            }

            if (replaceExisting)
            {
                base.Set(encName, encValue);
            }
            else
            {
                base.Add(encName, encValue);
            }
        }