1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var cookieManager = Cef.GetGlobalCookieManager();
cookieManager.SetStoragePath(GetAppDir("Cache"), false); /*true为保存cookie*/
cookieManager.SetSupportedSchemes(new string[] { "http" , "https" });
string[] arrcookies;
/*Common.setcookie 为将要cookies字符串*/
if (!Common.setcookie.IsNullOrEmpty())
{
arrcookies = Common.setcookie.Split(';');
int intEachCookPartsCount = arrcookies.Length;
for (int i = 0; i < intEachCookPartsCount; i++)
{
if (!arrcookies[i].IsNullOrEmpty())
{
int IndexofA = arrcookies[i].IndexOf('=');
bool status = cookieManager.SetCookie(Common.ToUrl, new Cookie
{
Name = arrcookies[i].Substring(0, IndexofA),
Value = arrcookies[i].Substring(IndexofA + 1),
});
}
}
}