HttpWebRequest gives a SocketException with error code 10050
Posted
by Shodan Is Alive
on Stack Overflow
See other posts from Stack Overflow
or by Shodan Is Alive
Published on 2010-03-19T17:00:33Z
Indexed on
2010/03/19
17:01 UTC
Read the original article
Hit count: 923
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 193.63.75.26: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?
© Stack Overflow or respective owner