public static void SetCookies(this IWebHttpResponseCookie Cookie, string Name, IList <WebHttpCookieValue> Values) { if (Cookie.Exist(Name)) { Cookie[Name] = Values; } else { Cookie.Add(Name, Values); } }
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); } }
public static WebHttpCookieValue GetCookie(this IWebHttpResponseCookie Cookie, string Name, WebHttpCookieValue Default = null) { var cookie = GetCookies(Cookie, Name, null); return(cookie == null ? Default : cookie[0]); }
public static IList <WebHttpCookieValue> GetCookies(this IWebHttpResponseCookie Cookie, string Name, IList <WebHttpCookieValue> Default = null) => Cookie.Exist(Name) ? Cookie[Name] : Default;