简体   繁体   中英

How to download a webpage source and show in webbrowser?

So I wanted to know if there is a way to download a webpage's source code and then show it in a webbrowser.

My main problem is user is going to use a web proxy in my application and sometimes these proxies have username and password but I don't want the user to always input his/her own password for the browser so I thought that I make a webclient request and set proxy and user/pass for it then download the source of the requested page and then show it in the webbrowser but if you know a way to for example give the webbrowser username and password please let me know.

thanks.

use

WebClient.downloadString();

msdn

But I suggest that you display the source in a good Editor like Notepad++ instead of a WebBrowser.

Edit: I don't know about passing username and passwort for the proxy though.

Edit2: webClient.Credentials = new System.Net.NetworkCredential("UserName", "Password", "Domain");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM