views:

73

answers:

2

I am using HttpWebRequest to download a remote file, however i get a 504 error. I pasted the url in firefox and the first and 3rd try it took 16seconds, the 2nd nothing happened (it looked like it timed out).

How do i decrease the 504 error? Would changing HttpWebRequest timeout help? should i attempt to retry the file (lets say 3 times) if i receive a 504 error?

A: 

That's a server problem. There's no way for you to prevent that. I would retry a couple of times adding some Thread.Sleep in between.

Gonzalo
+1  A: 

5xx is a server error. Look at the entity body of the response to see if the server gives any hint as to why this is happening.

You can get the entity body by getting the Response from the WebException object.

feroze
i like this answer too.
acidzombie24