/// ---------------------------------------------------------------------
/// <summary>
/// Get the content of a web page.
/// </summary>
/// <param name="url"> The URL of the Web page. </param>
/// <returns> The content of the page. </returns>
/// ---------------------------------------------------------------------
public static string GetPageContent(string url)
{
HttpWebResponse httpWResponse = null;
StreamReader sr = null;
string ans = null;
try
{
HttpWebRequest httpWRequest = (HttpWebRequest)WebRequest.Create(url);
httpWResponse = (HttpWebResponse)httpWRequest.GetResponse();
sr = new StreamReader(httpWResponse.GetResponseStream(), Encoding.GetEncoding("iso-8859-1"));
ans = sr.ReadToEnd();
}
catch
{
ans = null;
}
finally
{
if (httpWResponse != null) httpWResponse.Close();
if (sr != null) sr.Close();
}
return ans;
}