-
System.Net.WebException
Hey all,
I'm making a program that grabs the source code of a given web page. The following is the Method in question:
public string getPageSource(string URL){
try
{
System.Net.WebClient webClient = new System.Net.WebClient();
string strSource = webClient.DownloadString(URL);
webClient.Dispose();
return strSource;
}
catch (Exception ex)
{
return ex.ToString();
}
}
It works for some web pages, although for others it returns:
"WebException: Too many automatic redirections were attempted."
How do I go about fixing this, if I can? Thanks