httpwebrequest
webclient
System.Net.WebClient wc = new System.Net.WebClient();
wc.Credentials = System.Net.CredentialCache.DefaultCredentials;
Byte[] buffer= wc.DownloadData("");
string Content= System.Text.Encoding.Default.GetString(buffer);

解决方案 »

  1.   

    http://leonardleonard.javaeye.com/blog/277073自己看吧
      

  2.   

    http://www.busfly.cn/post/cs-web-WebClient-html.html
      

  3.   


    try
            {
                System.Net.WebRequest rqt = System.Net.WebRequest.Create(url);            System.Net.WebResponse rsp = rqt.GetResponse();            System.IO.Stream respStream = rsp.GetResponseStream();            System.IO.StreamReader read = new System.IO.StreamReader(respStream, System.Text.Encoding.GetEncoding("utf-8"));            return read.ReadToEnd();
            }
            catch (Exception)
            {
                
                throw;
            }
    学人家的。
      

  4.   

    用webbrowser控件吧webBrowser1.DocumentText
      

  5.   

    string html = Encoding.GetEncoding("GB2312").GetString(new WebClient().DownLoadData("网址"));
      

  6.   


    不行,这个只能到登陆界面的源码,如果有用户名,密码什么的,进不去我的IE已经打开在桌面,用户名密码登陆进去了,然后IE上有一些数据,这个时候点击IE的 查看--源码 , 是可以看到这些数据的,但是上面的代码不行
      

  7.   

    用这个,高歌一次回帖中提供的方法:static class WebFunc
    {
        private static CookieContainer cookie = new CookieContainer();
        private static string contentType = "application/x-www-form-urlencoded";
        private static string accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-silverlight, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-silverlight-2-b1, */*";
        private static string userAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)";    public static string GetHtmlEx(string url, Encoding encoding)
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            request.UserAgent = userAgent;
            request.ContentType = contentType;
            request.CookieContainer = cookie;
            request.Accept = accept;
            request.Method = "get";        WebResponse response = request.GetResponse();
            Stream responseStream = response.GetResponseStream();
            StreamReader reader = new StreamReader(responseStream, encoding);
            String html = reader.ReadToEnd();
            response.Close();        return html;
        }
    }
    //调用
    WebFunc.GetHtmlEx("网址",Encoding....)
      

  8.   

    昏了,不行,读取的还是登陆界面的数据html源码