public string GetPage()
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(this.URL.Trim());
request.ContentType = "text/html";
request.Method = "GET";
request.Proxy = WebProxy.GetDefaultProxy();
request.Proxy.Credentials = CredentialCache.DefaultCredentials;
string Input = string.Empty;
try
{
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
if (response.StatusCode == HttpStatusCode.OK)
{
using (StreamReader sr = new StreamReader(response.GetResponseStream()))
{
Input = sr.ReadToEnd();
// Close and clean up the StreamReader
sr.Close();
}
}
}
catch (Exception ex) { }
return Input;
}
Hiç yorum yok:
Yorum Gönder