首页  >  文章  >  php教程  >  读取网页页面代码 并保存

读取网页页面代码 并保存

WBOY
WBOY原创
2016-06-06 20:01:331170浏览

//使用空间 using System.Net; using System.IO; if (!IsPostBack) { WebClient client = new WebClient(); string reply = client.DownloadString("http://www.sina.com"); TextArea1.Value = reply; } FileStream fs = new FileStream(@"c:/aa.html", File

 

 

 

//使用空间

using System.Net;

using System.IO; 

 

if (!IsPostBack)

        {

            WebClient client = new WebClient();

            string reply = client.DownloadString("http://www.sina.com");

            TextArea1.Value = reply;

        }

 

 

        FileStream fs = new FileStream(@"c:/aa.html", FileMode.Create, FileAccess.Write);

        StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.UTF8);

        sw.Write(TextArea1.Value);

        sw.Close();

        fs.Close();

 

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn