将凭据,Cookie等从WebBrowser传输到HttpWebRequest [英] Transfer credentials , cookies, etc from WebBrowser to HttpWebRequest

查看:98
本文介绍了将凭据,Cookie等从WebBrowser传输到HttpWebRequest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!
我正在使用WebBrowser控件登录到安全的(https)网页,然后必须从该页面下载XML文件(一旦我登录)
我想使用HttpWebRequest下载文件,但是随后我必须从WebBrowser控件传递cookie,凭据等.

有人知道该怎么做吗?

先谢谢了.

/罗马


罗马阿里法诺夫(1989)-MCTS-MCAD-MCP-MCT-IT英雄-www.animaonline.blogspot.com

Hi everyone!
I'm using a WebBrowser control to log on to a secured (https) web page, then I have to download a XML File from this page (once I'm logged in)
I want to use HttpWebRequest to download the file, but then I have to pass cookies , credentials, etc from the WebBrowser control.

Does anyone know how to do that?

Thanks in advance.

/Roman


Roman Alifanov(1989)- MCTS-MCAD-MCP-MCT - IT Hero - www.animaonline.blogspot.com

推荐答案

您可能希望保留在WebBrowser控件的上下文中,并让代码为您执行一些自动单击和输入数据.您始终可以使用WebBrowser控件的文档"属性单击并在网站上输入信息.我已经此处详细介绍了如何执行此操作.将Firefox与Firebug结合使用,可以确定输入数据所需的控件.

根据特定网站的设置,这可能是最简单的方法.我实际上有一个定义的控件,该控件在后台使用WebBrowser替我登录网站.这非常有用.
You may want to stay in the context of the WebBrowser control instead, and have the code do some automatic clicking and entering data for you.   You can always click and enter information on a website using the WebBrowser control's Document property.  I've detailed how to do this here.  Use Firefox with Firebug to determine which controls you'll need to enter data for. 

Depending on the setup of the specific website, this may be the easiest way to do this.  I actually have a control I defined that uses a WebBrowser in the background to log into a website for me.  It's very useful.


这篇关于将凭据,Cookie等从WebBrowser传输到HttpWebRequest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆