Windows Authentication and WebServices

K

Kevin Harrison

I have an IIS6 site set to Windows Authentication only.

It contains a WebService that the site tries to access, however the SOAP
request always returns a 401 error:

The request failed with HTTP status 401: Unauthorized.
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClient
Message message, WebResponse response, Stream responseStream, Boolean
asyncCall) at

I've also tried consume it from an application with the same results.

The current Windows Identity (for the consuming site / application) is a
comain account with permission to access the WebService. I.e. the following
returns details of an NTLM domain account with permissions to access the web
service:

System.Security.Principal.WindowsIdentity.GetCurrent()
I've tried setting the identity for the current thread in the consumer, but
this doesn't make any difference (am I barking up the wrong tree?), i.e.:

System.Threading.Thread.CurrentPrincipal = new
System.Security.Principal.WindowsPrincipal(System.Security.Principal.Windows
Identity.GetCurrent())

How can I consume my Web Service?

BTW: The URL for the web service is in the Local Intranet zone on IE for all
clients.
 
J

Jan Tielens

Kevin

Try this:
'Create webservice instance...
webservice.Credentials = System.Net.CredentialCache.DefaultCredentials
webservice.PreAuthenticate = True
'Do webservice call.

Jan
 

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,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top