当前位置:网站首页>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
边栏推荐
- The whole network is the most complete. How to do interface automation test? Proficient in interface automation test details
- 幂等性实践操作,基于业务讲解幂等性
- MySQL port is occupied when building xampp
- 编码电机PID调试(速度环|位置环|跟随)
- Data mining series (3)_ Data mining plug-in for Excel_ Estimation analysis
- 手机连接电脑后,QT的QDIR怎么读取手机文件路径
- The most easy to understand dependency injection and control inversion
- Configuration table and page information automatically generate curd operation page
- Use split to solve the "most common words" problem
- 2022g2 boiler stoker examination question bank and online simulation examination
猜你喜欢
Charles uses three ways to modify requests and responses
类似Jira的十大项目管理软件
The most easy to understand service container and scope of dependency injection
Use of slice grammar sugar in C #
《C语言程序设计》(谭浩强第五版) 第8章 善于利用指针 习题解析与答案
Top ten project management software similar to JIRA
Node configuration environment CMD does not take effect
“如何实现集中管理、灵活高效的CI/CD”在线研讨会精彩内容分享
全新的ORM框架——BeetlSQL介绍
Fight leetcode again (290. Word law)
随机推荐
Aspnetcore configuration multi environment log4net configuration file
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).
A comprehensive understanding of static code analysis
通过 zxing 生成二维码
Xamarin effect Chapter 22 recording effect
数据库表中不建索引,在插入数据时,通过sql语句防止重复添加(转载)
[authentication / authorization] customize an authentication handler
软件测试相关知识~
Use of slice grammar sugar in C #
The most easy to understand dependency injection and control inversion
Web Course Design - his system
场景题:A系统如何使用B系统的页面
Blazor University (11) component - replace attributes of subcomponents
Seminar playback video: how to improve Jenkins' ability to become a real Devops platform
be based on. NETCORE development blog project starblog - (1) why do you need to write your own blog?
2022年P气瓶充装培训试题及模拟考试
MySql分组查询规则
求二叉树的叶子结点个数
7-11 重排链表 (25 分)
This new feature of C 11, I would like to call it the strongest!