//아래의 예제는 www.oraclejavanew.kr의 index.html을 클라이언트의 현재 폴더에 index.html이라는 이름으로 저장 하는 예제 입니다.
using System;
using System.Net;
using System.IO;
class OpenRead
{
static void Main()
{
byte[] bytes = new byte[409600];
WebClient client = new WebClient();
string URL = "http://www.oraclejavanew.kr/index.html";
Stream streamData = client.OpenRead(URL);
StreamReader sr = new StreamReader(streamData);
//파일을 생성 한다.
FileInfo file = new FileInfo (@".\index.html");
StreamWriter sw = file.CreateText();
sw.Write (sr.ReadToEnd());
Console.WriteLine("writing file...");
}
}



댓글 없음:
댓글 쓰기