标签:
方法1:
 HttpBaseProtocolFilter filter = new HttpBaseProtocolFilter();
                    var cookis = filter.CookieManager.GetCookies("http://dy.qq.com/passport/loginSuccess.htm");
方法2:
        string InternetGetCookieEx(string url)
        {
            uint sizeInBytes = 0;
            // Gets capacity length first
            InternetGetCookieEx(url, null, null, ref sizeInBytes, INTERNET_COOKIE_HTTPONLY, IntPtr.Zero);
uint bufferCapacityInChars = (uint)Encoding.Unicode.GetMaxCharCount((int)sizeInBytes);
            // Now get cookie data
            var cookieData = new StringBuilder((int)bufferCapacityInChars);
            InternetGetCookieEx(url, null, cookieData, ref bufferCapacityInChars, INTERNET_COOKIE_HTTPONLY, IntPtr.Zero);
            return cookieData.ToString();
        }
const int INTERNET_COOKIE_HTTPONLY = 0x00002000;
        [DllImport("wininet.dll", CharSet = CharSet.Unicode, SetLastError = true)]
        static extern bool InternetGetCookieEx(string pchURL, string pchCookieName, StringBuilder pchCookieData, ref System.UInt32 pcchCookieData, int dwFlags, IntPtr lpReserved);
标签:
原文地址:http://www.cnblogs.com/walleyekneel/p/4088943.html