Impersonate user for webservice status 401

J

jacques

I'm connecting to a web service from an asp.net page and trying to pass
the current asp.net page requesting user credentials to the web
service. My problem is a keep getting a 401 error from the web service,
when I check the log files of the server where the web service resides
I can see no user account details have been passed.

I have the web.config set as follows for the asp.net page consuming the
web service:

<authentication mode="Windows">
</authentication>
<authorization>
<allow users="*" />
<deny users="?" />
</authorization>
<identity impersonate="true"/>

When I check System.Threading.Thread.CurrentPrincipal.Identity.Name
before the web service call I see the username I'd expect.

I'm Setting the Web service credentials as follows:

WebService.Credentials = System.Net.CredentialCache.DefaultCredentials
From what I have read from MSDN and from other group posts this should
work and the users Credentials should be passed to my web service but I
still get a 401 status back and I can see that no user details are
passed to my web service.

I'm starting to pull me hair out over this, any help to stop me going
bald would be very much appreciated!

Jacques.
 

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,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top