Exemplo n.º 1
0
 public static string cookie(this HttpResponseBase response, string cookieName)
 {
     if (response.hasCookie(cookieName))
     {
         return(response.Cookies[cookieName].value());
     }
     return(null);
 }
        public static HttpCookie set_Cookie(this HttpResponseBase response, string name, string value)
        {
            if (response.isNull() || name.isNull())
            {
                return(null);
            }
            var httpCookie = (response.hasCookie(name))
                                ? response.Cookies[name]
                                : new HttpCookie(name);

            if (httpCookie.notNull())
            {
                httpCookie.Value = value;

                if ((response.hasCookie(name).isFalse()))
                {
                    response.Cookies.Add(httpCookie);
                }
            }
            return(httpCookie);
        }