Webclient DownloadString problem

by Feb 18, 2011



Some background info;
We use a traffic manager to distribute traffic between servers. When all servers behind a pool are down you are redirected to a 'sorry-page'. This sorry-page first gives a Error 503 to indicate that there is a problem but after that the sorry page is displayed.

When i use powershell to check if the sorrypage is active i get an error.

"DownloadString" with "1" argument(s): "The remote server returned an error: (503) Server Unavailable."
At line:10 char:32
+             $web.DownloadString <<<< ("http://serveraddress")
+ CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException

The Powershell code is:

$web = New-Object System.Net.WebClient

When i check the page in a browser the page is displayed normally.

Does anybody know how i can retrieve the content of the displayed webpage?

Best regards,