惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
宝玉的分享
宝玉的分享
月光博客
月光博客
B
Blog
云风的 BLOG
云风的 BLOG
Google DeepMind News
Google DeepMind News
Engineering at Meta
Engineering at Meta
aimingoo的专栏
aimingoo的专栏
N
Netflix TechBlog - Medium
博客园_首页
GbyAI
GbyAI
人人都是产品经理
人人都是产品经理
A
About on SuperTechFans
Y
Y Combinator Blog
L
LangChain Blog
有赞技术团队
有赞技术团队
D
Docker
爱范儿
爱范儿
博客园 - 司徒正美
H
Hackread – Cybersecurity News, Data Breaches, AI and More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
酷 壳 – CoolShell
酷 壳 – CoolShell
Microsoft Security Blog
Microsoft Security Blog
D
DataBreaches.Net

博客园 - 程序员海风

cef加载flash的办法 一个高性能的对象属性复制类,支持不同类型对象间复制,支持Nullable<T>类型属性 php检测php.ini是否配制正确 openwrt的路由器重置root密码 windows 7 + vs2010 sp1编译 x64位版qt4 解决SourceGrid在某些系统上无法用鼠标滚轮滚动的问题 判断一个点是否在多边形内部,射线法思路,C#实现 [转载]使用HttpWebRequest进行请求时发生错误:基础连接已关闭,发送时发生错误处理 让Dapper+SqlCE支持ntext数据类型和超过4000字符的存储 通过WMI - Win32_Processor - ProcessorId获取到的并不是CPU的序列号,也并不唯一 DataGridView中设置固定行高 csExWB Webbrowser禁止flash内容的显示 禁用IIS FTP默认的连接提示信息:“220-Microsoft FTP Service” C#使用RSA私钥加密公钥解密的改进,解决特定情况下解密后出现乱码的问题 在ASP.NET的单次请求中使用Singleton模式 Windows7的KB2488113补丁很重要,解决Windows7下软件无响应的问题 OpenFileDialog和SaveFileDialog使用不当会有文件夹共享冲突的问题 Cache-Control:nocache 会导致ie浏览器无法保存正确的图片类型 安装阿里旺旺2008会导致IE Webcontrols在客户端显示不正常
使用csExWB Webbrowser 控件获取HttpOnly的cookie
程序员海风 · 2011-10-31 · via 博客园 - 程序员海风

由于微软Webbrowser控件的限制,使用Webbrowser.Document.Cookie是不能获取到HttpOnly的cookie的。

解决办法:采用扩展的csExWB Webbrowser控件,csExWB Webbrowser控件支持对HTTP头的监控,这就给了我们读取HttpOnly Cookie数据的方法,

csExWB Webbrowser控件官方功能介绍:

csExWB介绍csEXWB is a C# .NET 2.0 control that creates, hosts and sinks the events of the original Webbrowser control (Not .NET or any other wrapper). Advanced customization and total control over the Webbrowser control are achieved via implementation of a number of interfaces, along with the addition of many methods, properties, events and a COM library. 主要功能之一,监控HTTP请求和响应

Monitor HTTP and HTTPS request and response headers for all resources, images, sounds, scripts, etc, with the opportunity to add your own headers

 通过这个特性,我们就可以获取到每一次请求的原始HTTP数据,然后想干什么干什么。

代码片段摘抄如下:

注册事件

this.cEXWB1.ProtocolHandlerOnResponse += new csExWB.ProtocolHandlerOnResponseEventHandler(this.cEXWB1_ProtocolHandlerOnResponse);
this.cEXWB1.ProtocolHandlerOnBeginTransaction += new csExWB.ProtocolHandlerOnBeginTransactionEventHandler(this.cEXWB1_ProtocolHandlerOnBeginTransaction);

 在事件里处理HTTP头

private void cEXWB1_ProtocolHandlerOnBeginTransaction(object sender, csExWB.ProtocolHandlerOnBeginTransactionEventArgs e)
        {

        }

        private void cEXWB1_ProtocolHandlerOnResponse(object sender, csExWB.ProtocolHandlerOnResponseEventArgs e)
        {
            //记录分析cookie
            string headers = e.m_ResponseHeaders;
            //.......自定义代码,对http头数据进行处理可以获得HttpOnly的Cookie
        }

 调用StartHTTPAPP()和StartHTTPSAPP()开始监控,调用StopHTTPAPP()和StopHTTPSAPP()方法停止监控。

cEXWB1.StartHTTPAPP();
cEXWB1.StartHTTPSAPP();

cEXWB1.StopHTTPAPP();
cEXWB1.StopHTTPSAPP();

 codeproject上的链接:http://www.codeproject.com/KB/miscctrl/csEXWB.aspx

googlecode上的项目主页:http://code.google.com/p/csexwb2/

这个控件比微软自带的Webbrowser控件好用很多,唯一不足是需要额外注册ActiveX组件。