C# | ASP.NET/C#
C# 웹에서 파일 다운받기
bboks.net
2010. 4. 29. 18:14
C#에서 웹에 있는 파일을 다운 받는 방법은 두가지가 있다. 둘다 WebClient 객체를 사용하지만 하나는 파일 다운만, 다른 방법은 Stream을 이용해 처리가 가능한 방법이다.
여기서는 파일 다운로드 방법만 소개한다. 나머지 방법은 아래의 출처에서~
[출처] Download And Upload A File Using C#
여기서는 파일 다운로드 방법만 소개한다. 나머지 방법은 아래의 출처에서~
using System.Net;
class Program
{
static void Main(string[] args)
{
try
{
WebClient client = new WebClient();
client.DownloadFile("http://www.google.co.kr/index.html",
"c:\\index.html");
}
catch (Exception e)
{
System.Console.WriteLine(e.StackTrace);
}
}
}
[출처] Download And Upload A File Using C#