码迷,mamicode.com
首页 > Windows程序 > 详细

Win RT Webview获取cookie

时间:2015-03-20 20:19:14      阅读:188      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!