有关于微软的IWebBrowser2::Navigate2/Navigate方法
我曾经的要求很简单,只是要在我内置BROWSER发请求在在头里加入COOKIE值,
但试来试去都不成,但有趣的是的,我在头里加入其它东西是可行的,如:
User-Agent: NetMe
请求时加上了,可如果是:Cookie:aa=bb,就加不上,找了好多地方,想找到答案,
最后在GOOGLE论坛里有人做了“解释”:
它问了微软的人,用该控件无法加COOKIE,FT!!!
http://groups.google.com/group/microsoft.public.windows.inetexplorer.ie5.programming.components.webbrowser_ctl/browse_thread/thread/72f156bc95dfbe34/f3078180122c5529%23f3078180122c5529?sa=X&oi=groupsr&start=2&num=3
code:
CString str="";
//this->m_editurl.GetWindowText(str);
//this->m_editurl.GetWindowText("http://localhost:8080/angel");
VARIANT varProject;
const char *pszMsg = "http://127.0.0.1:8080";
//const char *pszMsg1 = "User-Agent: NetAnts";
const char *pszMsg1 = "Cookie: JSESSIONID=0112BF7D0C9FD914716EE17AD2AD7913";
VARIANT p1;
VARIANT p2;
VARIANT p3;
VariantInit(&varProject);
VariantInit(&p1);
VariantInit(&p2);
VariantInit(&p3);
p2.vt = VT_BSTR;
p2.bstrVal = SysAllocString(A2BSTR(pszMsg));//_bstr_t("http://127.0.0.1:8080/angel");
CString *s = new CString(p2.bstrVal);
//AfxMessageBox((LPCTSTR)s);
varProject.vt = VT_BSTR;
p1.vt = VT_BSTR;
p1.bstrVal= SysAllocString(A2BSTR(pszMsg));
//CComBSTR bstrXml ;
//bstrXml.Attach(SysAllocStringLen(p,47));
//varProject.bstrVal = bstrXml;
varProject.bstrVal = SysAllocString(A2BSTR(pszMsg1));
this->m_ie.Navigate2(&p2,0,0,0,&varProject);
I'd like to add cookies when I call IWebBrowser2::Navigate.
For example:
SHDocVw::IWebBrowser2Ptr spBrowser;//already created
_variant_t vtEmpty;
_bstr_t bstrURL;// already set to valid URL;
_variant_t vCookie(_bstr_t("Cookie: foo = bar"));
spBrowser->Navigate
(
bstrURL,
&vtEmpty/*flags*/,
&vtEmpty/*frame*/,
&vtEmpty/*post data*/,
&vCookie/*headers*/
);
The cookie I set does not appear on the server. I assume that the
syntax I'm passing to the 'headers' argument of Navigate is incorrect,
but I see no documentation about exactly how to set 'headers'.
When I monitor the IE event BeforeNavigate2, it shows the 'header'
argument, which includes some garbled version of the characters I
put in vCookie.
Any help will be appreciated.
Thanks,
Paul Bradford
See RFC 2109. The óookie header is rather complex:
cookie = "Cookie:" cookie-version
1*((";" | ",") cookie-value)
cookie-value = NAME "=" VALUE [";" path] [";" domain]
cookie-version = "$Version" "=" value
NAME = attr
VALUE = value
path = "$Path" "=" value
domain = "$Domain" "=" value
For example:
Cookie: $Version="1"; Customer="WILE_E_COYOTE"; $Path="/acme"
$Version parameter is mandatory-- With best wishes, Igor Tandetnik
news:9d9iud$sf9$1@bob.news.rcn.net...
I set a breakpoint in BeforeNavigate2 and look at Headers. It contains
some of the characters from the 'headers' parameter in my call to
IWebBrowser::Navigate, but it's all garbled. There is something
about my 'headers' parameter to Navigate that is not correct, but
I don't know what.
What exactly should the 'headers' argument to IWebBrowser2::Navigate
look like?
In case anybody is interested, I went through Microsoft support
to find out more about this. Their answer: what I want to do is
not supported. The 'headers' argument to Navigate/Navigate2
CANNOT be used to set cookies. There is no way to set cookies
for an IWebBrowser2 object.
I consider this a bug, but what I think is unlikely to change anything :)
We solved my problem in a completely different way.
有关于微软的IWebBrowser2::Navigate2/Navigate方法相关推荐
- 【比较】CWebBrowser2类Navigate方法的一些问题
CWebBrowser2::Navigate2()之后,有时会收不到DocumentComplete事件? 这个事件在所有资源(包括链接的CSS.脚本.图片等等)下载完毕之后触发. IE的一个版本存在 ...
- Win10 Microsoft Store 微软商店 Error 0x00000193 解决方法
Win10 Microsoft Store 微软商店 Error 0x00000193 解决方法 参考文章: (1)Win10 Microsoft Store 微软商店 Error 0x0000019 ...
- Selenium运行IE报错This usually means that a call to the COM method IWebBrowser2::Navigate2() failed.解决方案
个人环境: selenium 3.14 JDK 1.8 win8 64位 用selenium运行IE的基本设置步骤: 1.勾选启用保护模式,并把安全级别都调到最低(要不然可能某些控件不显示) 2.设置 ...
- 微软正版验证补丁的解决方法
微软正版验证补丁的解决方法 2007-05-30 10:43:42 因为您自动更新下载并安装了微软验证操作系统是否是正版的更新补丁KB905474,微软也真是绝,您不能在"控制面板--添加/ ...
- 安装了微软正版验证补丁的解决方法
来自:http://bbs.zdnet.com.cn/thread-55371-1-1.html 安装了"微软正版验证补丁"的解决方法 最近微软发布了一个新的正版验证补丁(KB90 ...
- 破解微软KB905474正版验证补丁的方法
破解微软KB905474正版验证补丁的方法: 如果已安装微软KB905474正版验证补丁,请到 http://hi.baidu.com/zhaodx/blog/item/78219e503dc5826 ...
- win10小娜_win10锁屏界面启用微软小娜功能的方法
win10锁屏界面启用微软小娜功能的方法,win10系统自带有小娜功能,但一些用户不知如何启用小娜,其实我们可通过 锁屏界面中启用,不知如何操作的用户,请来看看下面的介绍吧. win10系统小娜助手可 ...
- 行人检测与重识别!华中科技大、微软深入挖掘,新方法实现新SOTA
点击上方↑↑↑"视学算法"关注我 来源:公众号 机器之心 授权 如何将目标检测和重识别融合进一个框架,帮助解决多目标跟踪任务?华中科技大学和微软亚洲研究院的研究者找出了这一方向的痛 ...
- vs试用期延长期到期_VS2017试用期到期后登录微软账户出现错误解决方法
关于使用VS2017试用期一个月到后,需要登录微软账户后进行认证后才能重新使用,但是登录成功后出现如下错误 We could not refresh the credentials for the a ...
最新文章
- 常用图像格式(PNG,JPG)到SGI图像格式(RGB,BW)的转换
- 【MM】采购退货的处理办法
- 常见的CSS和HTML面试题
- SpringBoot集成Redis用法笔记
- cmake编译多个文件夹_cmake多目录构建(二)
- 6.1bash编程入门值变量类型、for循环和算术运算
- Java loadlibrary分析及如何unload
- NI VISION视觉安装
- weiit-saas搭建部署教程
- Oracle的overlaps函数转换其他数据库语法
- 论文阅读:[2019 TSE] A Theoretical and Empirical Analysis of Program Spectra Diagnosability
- 12c rac在安装grid软件执行root.sh脚本的时候出现PRCT-1431,CLSRSC-180
- spring启动流程(一):启动流程概览
- Faceted project metadata file “/game/.settings/org.eclipse.wst.common.projec
- NoSql入门和概述
- Caicloud 开源 Nirvana:让 API 从对框架的依赖中涅槃重生
- 大智能时代,人工智能的研究热点是什么?
- Excel 处理重复数据的几种方法
- r语言软件GDINA_finTech MSc代做、代写Python程序语言、代写MSc program、代做Python设计帮做C/C++编程|代写R语言...
- 打印机耗材的发展趋势
热门文章
- opengl 大作业_「陪玩时光」糕妈:说说年糕的小学生活,先从陪作业和家长群聊起...
- qt中文件读取的方法(新手入门必看)
- 上海计算机协会竞赛平台——整除
- Java中判断两个Date时间段是否有交集的方法
- Angular中父子组件之间父组件给子组件传值、传递方法、传递自己
- 类DefaultWsdl 11定义中英文对比API文档
- SSM中怎样使用JUnit4+spring-test编写单元测试
- Use Cases in an Agile Backlog
- 如何在MacOS上创建第一个iOS Flutter应用
- 3、MySQL 8.0.20在Linux(centos 8)上搭建主从复制