首页 > 代码库 > webBroser获取cookie
webBroser获取cookie
//取当前webBrowser登录后的Cookie值 [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); //取出Cookie,当登录后才能取 private static string GetCookieString(string url) { // Determine the size of the cookie int datasize = 256; StringBuilder cookieData = new StringBuilder(datasize); if (!InternetGetCookieEx(url, null, cookieData, ref datasize, 0x00002000, null)) { if (datasize < 0) return null; // Allocate stringbuilder large enough to hold the cookie cookieData = http://www.mamicode.com/new StringBuilder(datasize); if (!InternetGetCookieEx(url, null, cookieData, ref datasize, 0x00002000, null)) return null; } return cookieData.ToString(); }
webBroser获取cookie
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。