Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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!
 

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 16-Feb-12 2:26am
Comments
Bernhard Hiller at 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 at 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 at 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 at 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
KapilWaghe at 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)

  Print Answers RSS
0 OriginalGriff 381
1 Sergey Alexandrovich Kryukov 265
2 Praneet Nadkar 237
3 Marcin Kozub 225
4 /\jmot 189
0 OriginalGriff 8,284
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,614
3 Maciej Los 4,989
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 16 Feb 2012
Copyright © CodeProject, 1999-2014
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