본문 바로가기
Language/C#

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

by Lohen 2016. 2. 4.
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");
    //...
}


반응형

'Language > C#' 카테고리의 다른 글

DateTime.ToString 메서드 (String)  (0) 2016.02.04
Decimal.ToString 메서드 (String)  (0) 2016.02.04
XML 특수문자  (0) 2016.02.04
[iBatis]동적 쿼리문 생성  (0) 2016.02.04
ibatis xml 문법  (0) 2016.02.04

이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다.