NameResolutionFailure

M

MDB

Hello All,

I keep getting a NameResolutionFailure error when I try a web request
getresponse when using a WebProxy. Anyone know what could be causing this?
If I do not use the proxy, everything works fine.

Below is what my code looks like.



req = (HttpWebRequest)System.Net.WebRequest.Create(strURL);

if(sProxyRequired == "Y")
{
WebProxy proxy = new
WebProxy(sProxyHTTPAddress.Trim(),Convert.ToInt32(sProxyPort));
proxy.Credentials = new NetworkCredential(sProxyUserName, sProxyPassword);
proxy.BypassProxyOnLocal = true;
req.Proxy = proxy;
}

//enncode the form data string into a byte array
b = System.Text.Encoding.ASCII.GetBytes(myPostData);

//send the data (only if there is data, time request dosn't)
if(b.Length > 0)
{
//Indicate Method as Post and set the Length and Type of Data being Posted
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.KeepAlive = true;
req.Timeout = 60000;
req.Headers.Add("POST","HTTP/1.1");
req.ContentLength = b.Length;
s = req.GetRequestStream();
s.Write(b, 0, b.Length);
s.Close();
}

res = (HttpWebResponse)req.GetResponse();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top