当前位置:网站首页>Cefsharp stores cookies and reads cookies
Cefsharp stores cookies and reads cookies
2022-04-23 03:16:00 【Pingshan CP3】
background : Need to be in Winform Store... In the client program Cookie, And you can take it out :
1. Storage Cookie
var cookieManager = CefSharp.Cef.GetGlobalCookieManager();
var domain="www.baidu.com";
cookieManager.SetCookie("http://"+domain, new CefSharp.Cookie
{
Domain= domain,
Name ="formText",//Cookie name
Value= station_name,//Cookie value
Expires=DateTime.Now.AddDays(7)// Expiration time
});
2. take Cookie
(1) You need to inherit the interface first ICookieVisitor
public class CookieVisitor : CefSharp.ICookieVisitor
{
public event Action<CefSharp.Cookie> SendCookie;
public bool Visit(CefSharp.Cookie cookie, int count, int total, ref bool deleteCookie)
{
deleteCookie = false;
if (SendCookie != null)
{
SendCookie(cookie);
}
return true;
}
}
(2) Defining events
string cookies="";
private void visitor_SendCookie(CefSharp.Cookie obj)
{
cookies+=obj.Name+":"+obj.Value;
if(obj.Name="userid"){
// Select specified cookie
}
}
(3) take Cookie
CookieVisitor visitor = new CookieVisitor();
visitor.SendCookie += visitor_SendCookie;// Registration events
var cookieManager = CefSharp.Cef.GetGlobalCookieManager();
cookieManager.VisitAllCookies(visitor);// Access all cookie, This step must have
// cookieManager.VisitUrlCookies("http://www.baidu.com", true, visitor);// Visit the specified website Cookie
You can take it out
版权声明
本文为[Pingshan CP3]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220627117208.html
边栏推荐
- 数据库表中不建索引,在插入数据时,通过sql语句防止重复添加(转载)
- 《C语言程序设计》(谭浩强第五版) 第9章 用户自己建立数据类型 习题解析与答案
- Why is bi so important to enterprises?
- C language to achieve address book - (static version)
- Knowledge of software testing~
- 编码电机PID调试(速度环|位置环|跟随)
- Mysql database, inconsistent index character set, slow SQL query, interface timeout
- Advanced sorting - fast sorting
- LoadRunner - performance testing tool
- Xamarin effect Chapter 21 expandable floating operation button in GIS
猜你喜欢

A set of combination boxing to create an idea eye protection scheme

《C语言程序设计》(谭浩强第五版) 第7章 用函数实现模块化程序设计 习题解析与答案
![[mock data] fastmock dynamically returns the mock content according to the incoming parameters](/img/1e/c4aad49d16fb21a19865ba75128e43.png)
[mock data] fastmock dynamically returns the mock content according to the incoming parameters

2022G2电站锅炉司炉考试题库及在线模拟考试

The whole network is the most complete. How to do interface automation test? Proficient in interface automation test details

Peut recevoir plusieurs paramètres de type de données - paramètres variables

How to achieve centralized management, flexible and efficient CI / CD online seminar highlights sharing

Utgard connection opcserver reported an error caused by: org jinterop. dcom. common. JIRuntimeException: Access is denied. [0x800

The most easy to understand service container and scope of dependency injection

C read / write binary file
随机推荐
MySQL port is occupied when building xampp
Experiment 5 components and event handling
7-11 重排链表 (25 分)
This new feature of C 11, I would like to call it the strongest!
超好用的Excel异步导出功能
《C语言程序设计》(谭浩强第五版) 第9章 用户自己建立数据类型 习题解析与答案
2022T电梯修理考试模拟100题及在线模拟考试
MySQL索引详解【B+Tree索引、哈希索引、全文索引、覆盖索引】
求二叉树的叶子结点个数
General testing technology [1] classification of testing
Five tips for cross-border e-commerce in 2022
The most detailed in the whole network, software testing measurement, how to optimize software testing cost and improve efficiency --- hot
超好用的【通用Excel导入功能】
Blazor University (12) - component lifecycle
Aspnetcore configuration multi environment log4net configuration file
The whole network is the most complete. How to do interface automation test? Proficient in interface automation test details
Due to 3 ²+ four ²= five ², Therefore, we call '3,4,5' as the number of Pythagorean shares, and find the array of all Pythagorean shares within n (including n).
Utgard connection opcserver reported an error caused by: org jinterop. dcom. common. JIRuntimeException: Access is denied. [0x800
【无标题】
js递归树结构计算每个节点的叶子节点的数量并且输出