Language/C#

C# Get Web Source / 웹사이트 소스 가져오기

Lohen 2016. 2. 4. 22:22
using System.Net;
//...
using (WebClient client = new WebClient ()) // WebClient class inherits IDisposable
{
    client.DownloadFile("http://yoursite.com/page.html", @"C:\localfile.html");

    // Or you can get the file content without saving it:
    string htmlCode = client.DownloadString("http://yoursite.com/page.html");
    //...
}


반응형