using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;
namespace ConsoleWebClient
{
class Program
{
static void Main(string[] args)
{
string uri = "http://www.cnblogs.com";
WebClient wc = new WebClient();
Stream st = wc.OpenRead(uri);
StreamReader sr = new StreamReader(st);
string res = sr.ReadToEnd();
sr.Close();
st.Close();
Console.WriteLine(res);
Console.ReadKey();
}
public void ReadPageContent()
{
string uri = "http://www.cnblogs.com";
WebClient wc = new WebClient();
byte[] bResponse = wc.DownloadData(uri);
string strResponse = Encoding.UTF8.GetString(bResponse);
Console.WriteLine(strResponse);
Console.ReadKey();
}
}
}
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;
namespace ConsoleWebClient
{
class Program
{
static void Main(string[] args)
{
string uri = "http://www.cnblogs.com";
WebClient wc = new WebClient();
Stream st = wc.OpenRead(uri);
StreamReader sr = new StreamReader(st);
string res = sr.ReadToEnd();
sr.Close();
st.Close();
Console.WriteLine(res);
Console.ReadKey();
}
public void ReadPageContent()
{
string uri = "http://www.cnblogs.com";
WebClient wc = new WebClient();
byte[] bResponse = wc.DownloadData(uri);
string strResponse = Encoding.UTF8.GetString(bResponse);
Console.WriteLine(strResponse);
Console.ReadKey();
}
}
}