jeudi 27 octobre 2016

C# Webservice Proxy Windows Authentication

I have a c# application which consumes a webservice through a client proxy. The webservice is setup on windows authentication (HTTP 401 challange through Active Directory).My user account is authorized to access the webservice.

When I call the webservice throug the browser it work well. The browser is able to do the 401 challange and does not ask for any user id password (as internally the server and client do it through AD controller).

The problem is that when I try to consume the service through the C# application, it throws HTTP request unauthorized error.

I have tried all the below options for the webservice proxy to do windows authentication. ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation ClientCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultCredentials as System.Net.NetworkCredential ClientCredentials.Windows.AllowedImpersonationLevel =System.Security.Principal.TokenImpersonationLevel.Impersonation

Can someone please help on how I can make the webservice call just like how the browser does. I cannot pass user id and password while calling the service.




Aucun commentaire:

Enregistrer un commentaire