Integrated Authentication - 401 Unauthorized Error

R

randyh

I have a Windows.Forms application that authenticates to an ASP.NET web
service using Active Directory Integrated Authentication. This has been
working fine for several months with the following code:

ServiceClient.Credentials =
System.Net.CredentialCache.DefaultNetworkCredentials;
ServiceClient.ExecuteMethod();

Recently a single user started receiving a (401) Unauthorized error every
time the ServiceClient attempts to execute a method. The same user account
can login to the web service through a web browser, but no matter what I try
I cannot get integrated auth to work with my application for this one user.

There are other accounts in the exact same OU with the same group
memberships that can use the application without any problems. There must be
something I'm missing, does anyone have any ideas?

Thanks,
Randy
 
C

CSharpner

Try this:

ServiceClient.Credentials =
System.Net.CredentialCache.DefaultNetworkCredentials;
ServiceClient.UnsafeAuthenticatedConnectionSharing = true;
ServiceClient.PreAuthenticate = true;
ServiceClient.ExecuteMethod();

I write plenty of WinForms apps that call web services. I initially
went through a lot of trouble trying to get this to work too, but
finally got it all working a good while ago.

HTH
http://csharpner.blogspot.com
 

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

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,044
Latest member
RonaldNen

Latest Threads

Top