Webbrowser的Navigate替换为WebRequest的功能,这可能吗? [英] Webbrowser's Navigate replaced by WebRequest's function, is that possible?

查看:76
本文介绍了Webbrowser的Navigate替换为WebRequest的功能,这可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用C#2005制作自己的自定义浏览器.我使用的是webbrowser控件.
此控件中有一个名为Navigation的功能,它使我们可以导航到特定的url,因此网页将显示在控件上.不再使用该导航功能.我决定改用System.net.webrequest的函数.这有可能吗...

我尝试做这样的事情:
WebRequest request = WebRequest.Create(" http://www.google.com.sg");
WebResponse response = request.GetResponse();

this.webBrowserCtrl.DocumentStream = response.GetResponseStream();


但是我的WebBrowserCtrl根本没有显示Google主页!相反,它什么也不显示.
这是怎么回事?


或者System.net中还有其他任何类,我可以使用这些类从特定的url获取网页,并将该网页显示到webBrowserCtrl.???

I am currently making my own custom browser using C# 2005. I use webbrowser control.
Inside this control, there is a function called navigate, which allow us to navigate to a particular url, and the webpage will thus be displayed on the control..So far so good

But i decide not to use that navigate function anymore. I decide to use System.net.webrequest's functions instead. Is that possible...

I try to do something like this:
 WebRequest request = WebRequest.Create("http://www.google.com.sg");
 WebResponse response = request.GetResponse();
   
this.webBrowserCtrl.DocumentStream= response.GetResponseStream();


but my WebBrowserCtrl did not display the google homepage at all!!! Instead it display nothing.
What is happening?


Or is there any other classes in System.net , that i can use to obtain webpage from a particular url, and display that webpage into the webBrowserCtrl.???

推荐答案

我需要做同样的事情,找到解决方案了吗?

I need to do the same thing, have you found a solution?

谢谢

Erik


这篇关于Webbrowser的Navigate替换为WebRequest的功能,这可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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