我尝试了以下两种方法来获取网页的源代码,但都无法打开网页。两种方法都通过异常远程服务器403禁止
string htmlstring = String.Empty;
WebClient wc = new WebClient();
htmlstring = wc.DownloadString(website);
和
string htmlstring = String.Empty;
WebRequest request = WebRequest.Create(website);
WebResponse response = request.GetResponse();
Stream dt = response.GetResponseStream();
StreamReader sr = new StreamReader(dt);
htmlstring = sr.ReadToEnd();