Wednesday, February 15, 2012

The remote server returned an error: (504) Gateway Timeout.

I am using the code below to download file.

WebClient myWebClient = new WebClient();
 myWebClient.DownloadFile(myStringWebResource, fileName);

But suddenly I have started to get 504 error. After adding header, the error has gone.


myWebClient.Headers["User-Agent"] = "Mozilla/4.0 (Compatible; Windows NT 5.1; MSIE 6.0)" +
                " (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";

0 comments: