469,610 Members | 2,305 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,610 developers. It's quick & easy.

WebProxy support NTLM?

Consider accessing a webpage through a proxy server:

WebRequest request = WebRequest.Create("http://somepage.com");
WebProxy proxy = new WebProxy(proxyHost, proxyPort);
proxy.Credentials = new NetworkCredential(proxyUsername,
proxyPassword);
request.Proxy = proxy;

Now suppose the *proxy server* authenticates using NTLM (somepage.com
does NOT require any authentication its just a webpage). How does one
tell the WebProxy object to use NTLM?

I have tried the following not expecting much and it didnt do much:

proxy.Credentials = new
NetworkCredential(proxyUsername,proxyPassword).Get Credential(proxyURI,
"NTLM");

Regards,

--
Wal
http://www.vooose.com

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #1
4 12805
vooose wrote:
Consider accessing a webpage through a proxy server:

WebRequest request = WebRequest.Create("http://somepage.com");
WebProxy proxy = new WebProxy(proxyHost, proxyPort);
proxy.Credentials = new NetworkCredential(proxyUsername,
proxyPassword);
request.Proxy = proxy;

Now suppose the *proxy server* authenticates using NTLM (somepage.com
does NOT require any authentication its just a webpage). How does one
tell the WebProxy object to use NTLM?

I have tried the following not expecting much and it didnt do much:

proxy.Credentials = new
NetworkCredential(proxyUsername,proxyPassword).Get Credential(proxyURI,
"NTLM");


The NetworkCredential covers all challenge/response schemes registered
with the AuthenticationManager class, including NTLM. Your first code
snippet should work fine.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 21 '05 #2
Thanks for your reply.

Now I have a slightly different question. Suppose you were using a
non-HTTP protocol but were still required to authenticate with the NTLM
proxy - something like the following would be good:

TCPClient client = new TCPClient(..);
client .Credentials = new
NetworkCredential(proxyUsername,proxyPassword).Get Credential(proxyURI,"N
TLM");

Doing this for "Basic" authentication is easy, because you just
construct a simple statement to write to the network stream (for the
proxy). However with NTLM its more involved and besides its already
been done! (for HTTP)

I would have thought there were a million and one applications that
require authentication via NTLM that *DON'T* user HTTP-style protocols
on top of TCP. I can't find much!

Regards

--
Wal
http://www.vooose.com

*** Sent via Developersdex http://www.developersdex.com ***
Nov 23 '05 #3
vooose wrote:
Thanks for your reply.

Now I have a slightly different question. Suppose you were using a
non-HTTP protocol but were still required to authenticate with the
NTLM proxy - something like the following would be good:

TCPClient client = new TCPClient(..);
client .Credentials = new
NetworkCredential(proxyUsername,proxyPassword).Get Credential(proxyURI,
"N TLM");

Doing this for "Basic" authentication is easy, because you just
construct a simple statement to write to the network stream (for the
proxy). However with NTLM its more involved and besides its already
been done! (for HTTP)
You might want to check out Keith Brown's .NET Developer's Guide to
Windows Security. I'm afraid I'm not a great help here.
I would have thought there were a million and one applications that
require authentication via NTLM that DON'T user HTTP-style protocols
on top of TCP. I can't find much!


Don't forget that HTTP is ubiquitous, whereas a million and one
applications implementing their own application protocol are all
oddities ;-)

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 23 '05 #4
Thanks for the heads up. I will check out Mr Brown

--
Wal
http://www.vooose.com

*** Sent via Developersdex http://www.developersdex.com ***
Nov 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Sam Santiago | last post: by
reply views Thread by Michael S. Scherotter | last post: by
1 post views Thread by Andy Fish | last post: by
4 posts views Thread by Andrew | last post: by
3 posts views Thread by George Vasiliou | last post: by
1 post views Thread by pycraze | last post: by
7 posts views Thread by Phil | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.