HttpWebRequest setting error proxy(password error),but response success

  • Thread starter Thread starter ly108
  • Start date Start date
L

ly108

Guest
My C# program calls Httpwebrequest to access the server and get a response. When my proxy is set incorrectly(password error), I hope response fails, but it responds successfully. Here is my setting.

HttpWebRequest request = null;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
request = WebRequest.Create(url) as HttpWebRequest;
request.Method = "GET";
request.UserAgent = userAgent;
WebProxy proxy = new System.Net.WebProxy("http://" + ProxyServer + ":" + ProxyPort);
request.Proxy = proxy;
NetworkCredential ncProxy = new NetworkCredential(UserName, PassWord);
request.Proxy.Credentials = ncProxy;
request.Timeout = 15000;
response = request.GetResponse() as HttpWebResponse;

Continue reading...
 
Back
Top