Search This Blog

Wednesday, October 03, 2012

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

We had a similar situation in one of our projects. And adding the following headers to WebClient was the right solution for us too. Thanks to ─░brahim Uluda─č for sharing this information.


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)"
;

1 comment:

Vineel Kumar Reddy Kovvuri said...

you saved my day. Thanks alot.