示例#1
0
        private bool IsResponseCookiePresent(HttpURLConnection proxyConn, string expectedName
                                             , string expectedValue)
        {
            IDictionary <string, IList <string> > headerFields = proxyConn.GetHeaderFields();
            IList <string> cookiesHeader = headerFields["Set-Cookie"];

            if (cookiesHeader != null)
            {
                foreach (string cookie in cookiesHeader)
                {
                    HttpCookie c = HttpCookie.Parse(cookie)[0];
                    if (c.GetName().Equals(expectedName) && c.GetValue().Equals(expectedValue))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }