PC Review


Reply
Thread Tools Rate Thread

Automatically authenticating with a Web proxy

 
 
Arun Bhalla
Guest
Posts: n/a
 
      22nd Jun 2004
I am developing an Internet Explorer bar, much like the Search sidebar. I
need to make Web requests, and generally I use mshtml.HTMLDocument for that
when I'm retrieving Web pages, but occasionally I need to make a lightweight
connection to a Web service, and for that I use WebRequest.

The problem is that one of my clients uses an authenticating Web proxy.
Apparently they need to login once with the username/password at the
beginning of an Internet Explorer session, and from then on they are
authenticated. When I'm using HTMLDocument, I don't have any trouble with
the proxy as I suspect IE is using the same code. However, when I use
WebRequest, I get proxy authentication errors, so I know that I have to
authenticate with the proxy.

With some testing, I learned that

System.Net.WebProxy proxy = System.Net.WebProxy.GetDefaultProxy();
proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
System.Net.GlobalProxySelection.Select = proxy;
System.Net.WebRequest wr = System.Net.WebRequest.Create(http://www...);

does not work, butSystem.Net.WebProxy proxy =
System.Net.WebProxy.GetDefaultProxy();proxy.Credentials = new
System.Net.NetworkCredential(user,
password);System.Net.GlobalProxySelection.Select =
proxy;System.Net.WebRequest wr =
System.Net.WebRequest.Create(http://www...);does.That is, .NET does not
automatically detect the user/password pair which was inputted at the
beginning of the IE session. The proxy settings seem to be static as
GetDefaultProxy() returns the correct proxy address and port, but the
credentials are empty. Furthermore, I don't know how I would be able to
establish Web connections under the current proxy session within .NET. Since
I expect a possible enterprise-wide deployment with this client, and
possibly other enterprises, I would like to be able to use the proxy without
having to request and maintain the user's proxy password (securely).Does
anyone know a way to go about this? If I have to poke around IE's registry
settings to get this information, I'll happily do so, although it would be
nicer to simply use .NET framework methods (e.g. GetDefaultProxy()). I've
been poking around on this topic off and on for the past week or two, and
I'm fairly stumped. It seems I may have to request the authentication
information during the installation process, but that seems less than
ideal.Thanks!Arun


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting HTTP 400 errors with multithreaded webservice calls through an authenticating ISA proxy JohnH Microsoft Dot NET Framework 0 31st Jul 2007 11:29 PM
Web Service / Authenticating Proxy .NET and COM interop =?Utf-8?B?d2hvYXJleW91?= Microsoft Dot NET Framework 9 24th Feb 2006 05:25 AM
Web Service / Authenticating Proxy Server - COM interop vs. .NET =?Utf-8?B?d2hvYXJleW91?= Microsoft Dot NET Framework 0 25th Jan 2006 02:17 AM
Authenticating Local Proxy =?Utf-8?B?SWdvcg==?= Windows XP Networking 3 17th Jun 2005 03:48 PM
Access remoting object begin authenticating proxy Scott Simms Microsoft Dot NET Framework 1 13th Oct 2003 08:25 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:03 AM.