Click here to Skip to main content
13,198,068 members (51,055 online)
Rate this:
Please Sign up or sign in to vote.
See more:

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!

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())

kind regards and thanks in advance!
Posted 16-Feb-12 1:26am
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?
KapilWaghe 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!
KapilWaghe 6-Apr-12 12:29pm

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.

KapilWaghe 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.



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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.171020.1 | Last Updated 16 Feb 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100