I got the solution. :D
================================================== ===================
using System.IO;
using System.Text;
using System.Net;
private void Button1_Click(object sender, System.EventArgs e)
{
WebClient webClient = new WebClient();
const string strUrl = "http://www.yahoo.com/";
byte[] arrHtml;
arrHtml = webClient.DownloadData(strUrl);
UTF8Encoding objUTF8 = new UTF8Encoding();
using(FileStream fs = File.Create("c:\\sample-webpage.doc"))
{
byte[] arrContent = arrHtml;
fs.Write(arrContent,0, arrContent.Length);
}
}
|