asp.net中利用WebClient查看网站的源代码

    技术2022-05-11  68

         private static string GetSourceCode(string url)    {        string OriginalURL, Subject, date;        WebClient webClient = new WebClient();        byte[] data = webClient.DownloadData(url);        string content = System.Text.Encoding.Default.GetString(data);        return content;    }

    调用太简单了啊

    TextBox1.Text =GetSourceCode(http://blog.csdn.net/teng_s2000);

    注意:使用的时候不要忘记引入命名控件System.Net;

    测试环境:xpsp2+vs2005


    最新回复(0)