using System using System IO using System Net namespace Tabor public c

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.IO;
using System.Net;
namespace Tabor
{
public class Bob
{
public string Lookup(string url)
{
WebRequest webRequest = WebRequest.Create(url);
webRequest.Credentials = CredentialCache.DefaultCredentials;
HttpWebResponse httpWebResponse = (HttpWebResponse) webRequest.GetResponse();
Console.WriteLine(httpWebResponse.StatusDescription);
Stream responseStream = httpWebResponse.GetResponseStream();
StreamReader streamReader = new StreamReader(responseStream);
string str = streamReader.ReadToEnd();
streamReader.Close();
responseStream.Close();
httpWebResponse.Close();
return str;
}
}
}