通过WebClient来获取网络内容

Thread t = new Thread(new ThreadStart(ProcessWeb));
t.Start();

private void ProcessWeb()
{
WebClient wc = new WebClient(); 
wc.OpenReadCompleted += wcOpenReadCompleted;
wc.OpenReadAsync(new Uri("http://www.oschina.net/wp7"));
}

private void wcOpenReadCompleted(object sender, OpenReadCompletedEventArgs args)
{
if (!args.Cancelled && args.Error == null)
{
args.Result ; //这里保存着二进制结果。
}
}

  

posted on 2012-04-26 14:11  wchao911  阅读(200)  评论(0编辑  收藏  举报

导航