首页 > Windows开发 > 详细

Win RT Webview获取cookie

时间:2015-03-20 20:16:43      阅读:413      评论:0      收藏:0      [点我收藏+]

方法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);

Win RT Webview获取cookie

原文:http://www.cnblogs.com/walleyekneel/p/4088943.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!