views:

121

answers:

0

Hi everybody

I'm pulling my hairs off since two days now because I'm trying to download an image from a website using HttpWebRequest.
When I call the method "GetResponse" of that class, I get the WebException "Unable to connect to the remote server.". The inner exception is "A socket operation encountered a dead network xxx.xxx.xxx.xxx:80".
After some trial and error, I created a new website to test only that portion of code and it works.

I thought it could be the proxy settings so I changed settings for both of the websites according to some clues I found googling around but the situation remains the same.

Basically the code I execute is this

xHttpReq = System.Net.HttpWebRequest.Create(New Uri(uri))

xHttpReq.Timeout = 30000

xHttpResp = xHttpReq.GetResponse() '<-- here's where I get the error

xRespStream = xHttpResp.GetResponseStream

I can't figure out what I'm doing wrong... can someone help me?