How to call a web service using NT Authentication from Web Service

J

John Lee

Hi,

I have two web services and they are setup as "Integrated Windows
Authentication" only and they are both assigned to application pool with
Domain Account.

I can use ws.Credentials = System.Net.CredentialCache.DefaultCredentials;
(ws is a web service proxy request instance) to call the web service BUT
this method does not work if I want to call another web service from one web
service.

I guess the DefaultCredentials does not have anything because there is no
logon involved? So How could I call another web service from one web service
using NTLM?

Thanks a lot!
John
 
S

Steven Cheng[MSFT]

Hi John,

Thanks for your posting. Regarding on this post, I've also found your
another thread in this group
"How to call a web service using NT Authentication"
which is focus on calling webservice from winform client and I've posted
my reply there. And I've also mentioned the asp.net client scenario there
also.

Also, based on my local test when use the

PROXY.Credentials = System.Net.CredentialCache.DefaultCredentials;

the DefaultCredentials will represent the asp.net's process identity (if
not using the impersonate) and it works well. Not sure what's the problem
on your side, are you still recieving 401 access denied?

In addition, I've also mentioned how to programly create a NTLM
networkCredential and pass it to the webservice client proxy, here is the
code snippet:
===================
MyService.MyService ms = new MyService.MyService();

System.Net.NetworkCredential nc = new
System.Net.NetworkCredential("username","password","domainame");
System.Net.CredentialCache cc = new System.Net.CredentialCache();
cc.Add(new Uri(ms.Url),"NTLM",nc);
ms.Credentials = cc;

ms.Execute("dfdsfds");
=====================

If there is any other questions, please feel free to post here or in that
thread. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

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

Top