使用网络响应加载网络浏览器 [英] Load web browser with web response

查看:91
本文介绍了使用网络响应加载网络浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用创建在线帐户的应用程序(假设Gmail)
当用户运行应用程序时,我将WebBrowser控件导航到Url。用户填写注册表格并完成注册。
到这里为止一切正常。
现在用户想要使用代理访问该站点。
我希望用户以另一种形式设置代理,当他运行应用程序时,他的请求将由该代理自动处理。
一种解决方案是,我先导航到代理,然后用户输入他的网站,然后在该代理服务器中导航。
但是我希望用户不要看到代理服务器网页,而只能看到通过代理访问的愿望页面。

I am working in an application that creates online accounts(Let suppose Gmail) When user run application i navigate the WebBrowser control to Url.User fill the registration form and complete the registration. It is working fine up to here. Now user want to use proxy to access that site. What I want user sets proxy in another form and when he runs application his request is automatically handled by that proxy. One solution is that I first navigate to proxy and then user enter his website and then navigate through that proxy server. But I want that user dose not see proxy server web page and only sees the desire page accessed through proxy.

我读了一篇使用<$的帖子c $ c> WebRequest 类导航到网站,并将my

请求的代理设置为需要代理,然后使用此响应加载WebBrowser。
如何设置WebBrowser代理
如何加载Webbrowser控件有回应吗?
是否可以按预期工作?

I read in a post that use WebRequest class to navigate to web site and set the proxy of my
request to desire proxy and then load WebBrowser with this response. how to set WebBrowser proxy How to load Webbrowser control with response? Will this work as desired?

推荐答案

 HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("http://example.com");
 webRequest.Proxy = new WebProxy(host, port);

 HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
 Stream receiveStream = response.GetResponseStream();

 WebBrowser webBrowser = new WebBrowser();
 webBrowser.DocumentStream = receiveStream;     

这篇关于使用网络响应加载网络浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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