Proxy Authentication

A

Andrew

Hi All

In the .NET Framework is there any way to provide the proxy
authentication the way internet explorer prompts.

I mean when I access the net using internet explorer it asks for the
username and password. I want that when I create a Web-Request it also
prompts for the username and password for the proxy server exactly the
way it asks for the internet explorer.

Presently it just simply gives the error with 407 status code stating
that proxy authentication is required.


The code is as follows:


Uri myUri =new Uri("http://www.google.co.in/");
WebRequest client = WebRequest.Create(myUri);
client.Proxy = System.Net.WebProxy.GetDefaultProxy();
myResponse = client.GetResponse();
data = myResponse.GetResponseStream();
reader = new StreamReader (data);
String str = reader.ReadToEnd ();


Regards
Andrew
 
S

Scott Allen

The problem is: WebRequest can be used from all sorts of environments:
ASP.NET, Windows Forms, a background service, a Pocket PC. WebRequest
doesn't know how to prompt a user, not could it really be done in a
way that works under all these different environments. You'll have to
prompt and provide the information to WebRequest.

HTH,
 

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

Members online

No members online now.

Forum statistics

Threads
473,930
Messages
2,570,072
Members
46,522
Latest member
Mad-Ram

Latest Threads

Top