Пример #1
0
 public static void SetCookies(this IWebHttpResponseCookie Cookie, string Name, IList <WebHttpCookieValue> Values)
 {
     if (Cookie.Exist(Name))
     {
         Cookie[Name] = Values;
     }
     else
     {
         Cookie.Add(Name, Values);
     }
 }
Пример #2
0
 public static void SetCookie(this IWebHttpResponseCookie Cookie, string Name, WebHttpCookieValue Value)
 {
     if (Cookie.Exist(Name))
     {
         Cookie.Clear(false);
         var list = new List <WebHttpCookieValue>(1);
         list.Add(Value);
         Cookie[Name] = list;
     }
     else
     {
         Cookie.Add(Name, Value);
     }
 }
Пример #3
0
        public static WebHttpCookieValue GetCookie(this IWebHttpResponseCookie Cookie, string Name, WebHttpCookieValue Default = null)
        {
            var cookie = GetCookies(Cookie, Name, null);

            return(cookie == null ? Default : cookie[0]);
        }
Пример #4
0
 public static IList <WebHttpCookieValue> GetCookies(this IWebHttpResponseCookie Cookie, string Name, IList <WebHttpCookieValue> Default = null) => Cookie.Exist(Name) ? Cookie[Name] : Default;