CredentialCache.DefaultCredentials not working!!!!!

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
 
S

Scott Allen

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,
 

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,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top