WebBrowser获取完整的Cookie
WebBrowser 获取Cookie 1.string cookieStr = WebBrowser.Document.Cookie;//获取不全 2. [DllImport("wininet.dll", CharSet = CharSet.Auto, SetLastError = true)] static extern bool InternetGetCookieEx(string pchURL, string pchCookieName, StringBuilder pchCookieData, ref int pcchCookieData, int dwFlags, object lpReserved); private static string GetCookieString(string url) { //确定cookie的大小 int datasize = 512; StringBuilder cookieData = new StringBuilder(datasize); if (!InternetGetCookieEx(url, null, cookieData, ref datasize, 0x00002000, null)) { if (datasize < 0) return null; //分配足够大的stringbuilder以容纳cookie cookieData = new StringBuilder(datasize); if (!InternetGetCookieEx(url, null, cookieData, ref datasize, 0x00002000, null)) return null; } return cookieData.ToString(); }