When trying to download an image from a specific image hoster using HttpWebRequest I get the error
The underlying connection was closed: An unexpected error occurred on a send.
Example image I'm trying this: https://static.dyp.im/u1F6o6Q0SW/03b0aef5a48efec8ba3c1b59009e60e4.jpg
This is the code I'm using:
HttpWebRequest request = (HttpWebRequest) HttpWebRequest.Create(remoteFilename);
response = request.GetResponse();
The error gets thrown on the GetResponse()
line.
Downloading the image works using a browser. I also tried using the same headers a browser uses (User agent, Accept, Connection etc) but the error persists.