CredentialCache.DefaultCredentials not working!!!!!

  • Thread starter Thread starter Paul Cheevers
  • Start date Start date
P

Paul Cheevers

Hi,

I'm trying to use the CredentialCache.DefaultCredentials to pick up the
credentials of the current user but its not working correctly. I've switched
off anonymous access and gone thru the code in debug mode but I keep getting
a 401 security exception. The code works perfect if I hard code a user name
and password.

After a lot of messing around I got it to work on the server (if I navigate
to the webpart that contains the code from a browser on the actual server)
when I set my browser to automatically logon on. However the code still
breaks on client machines even if I make this change.

This is driving me nuts, any help or suggestions would be appreciated.

Cheers,
Paul
 
Hi Paul:

It sounds as if you are running into the one hop limit of NTLM
authentication. The client's credentials can make on hop - from the
browser to the server. The server cannot use those credentials to make
another network hope. This would explain why it works when you are
using the application on the server.

One way to get around this is to enable delegation:
http://support.microsoft.com/default.aspx?scid=kb;en-us;810572

Another option is to use the NetworkCredential class.

HTH,
 
Back
Top