i have an application that loads the page content. I use the WebClient class. I need to retrieve the contents even when the server returns an error such as 404, 500, …
I need something like this:
WebClient wc = new WebClient();
string pageContent;
try {
pageContent = wc.DownloadString("http://example.com/page");
}
catch (WebException ex)
{
pageContent = ex.Response.PageContent; // <-- I need this
}
You can try this: