//Fredrik
#region Using declarations
...
using System.Net;
using System.IO;
#endregion
...
protectedoverridevoid OnBarUpdate()
{
// START
class GetPage
{
public String DownloadPage(Uri url)
{
WebRequest http = HttpWebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)http.GetResponse();
StreamReader stream = new StreamReader(response.GetResponseStream(),System.T ext.Encoding.ASCII );
String result = stream.ReadToEnd();
response.Close();
stream.Close();
return result;
}
publicvoid Go(String page)
{
Uri u = new Uri(page);
String str = DownloadPage(u);
Console.WriteLine(str);
}
[STAThread]
staticvoid Main(string[] args)
{
GetPage module = new GetPage();
String page;
if (args.Length == 0)
page = "http://di.se/";
else
page = args[0];
module.Go(page);
}
// STOP
}
#region Properties
#endregion
}
...
Comment