I'm using a little code to grab an image given its URL, and it's working for me for all URLs I tried except one:
http://title.mximg.com/img/logo/bizrealty.com.gif
For this URL, I'm getting "The underlying connection was closed: An unexpected error occurred on a receive."
However, if you open that URL with a browser, it loads perfectly.
Apparently that error message means:
"The underlying connection was closed: An unexpected error occurred on a receive."
--Seen when the client had sent the request in its entirety and got a TCP ACK-FIN or RST from server to close the connection, without a response from server.
But I have no idea what that means :-(
The code is simply:
Dim req As System.Net.HttpWebRequest = DirectCast(WebRequest.Create(ImageURL), HttpWebRequest)
req.Method = "GET"
Dim resp As Net.HttpWebResponse = DirectCast(req.GetResponse(), Net.HttpWebResponse)
UPDATE: Setting KeepAlive to false doesn't help it. Also, it's not a timeout issue, I'm getting the error quite fast.
Any idea what could be going on?
Thanks!