Click here to Skip to main content
15,887,416 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello

I'm trying to build an application that checks the availiability of some internet addresses. Therefor, i'm doing a webrequest. I need to use a proxy server on which the user, under which the application is running, isnt allowed. Thus i'm setting the proxy credentials. Unfortunately I always get a "407 proxy authentication required" error. When I run the application under an user that is allowed on the proxy, it works finde. It seems that the credentials wouldnt work but i have no idea what else to do?
Hopefully someone can help me with the problem!


C#
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("address");  
var proxy = new WebProxy("proxy", 8080);
proxy.Credentials = new System.Net.NetworkCredential("user", "password", "doamin");
request.Proxy = proxy;
request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50215)";
request.Method = "GET";
request.ContentType = "text/html";
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
    //code
}


kind regards and thanks in advance!
Posted
Comments
Bernhard Hiller 17-Feb-12 3:54am    
Some hints, not sure whether that's the solution:
- var proxy = new WebProxy("http://proxy", 8080);
- did you check for typos in the credentials?
Kapil Waghe 5-Apr-12 15:44pm    
Hey did you got the solution for the problem. Please let me know I am having the same problem.
lucius234 5-Apr-12 16:32pm    
unfortunately no. No idea how to solve... We are using a proxy without authentication now. Not really a solution. Let me know if you find something - would be very thankful! This problame made me crazy.;)
Cross my fingers for you!
Kapil Waghe 6-Apr-12 12:29pm    
Hello,

Thanks for the reply. Really its a hair pulling issue.
I am trying continuously since last 4 days.
Definitely I will come to you as I got the solution. Well in you answer you told that :We are using a proxy without authentication now. Not really a solution.
It means that you are using free proxies not paid/private proxies?

Please let me know if you got something.

Awaiting your response.

Thanks
Kapil
Kapil Waghe 7-Apr-12 9:30am    
Hey I got something...
I contacted to the proxy provider and said that :
"some locations in India have difficulties connecting to our servers in PA." so they gave me new proxies and they are working great. It means that it is an issue of the proxy server and the current location we are in.

Right???

Thanks
Kapil

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900