Passing Credentials to a Web Service

R

Ramjee Tangutur

Hi Al
We have a web service (developed in C#). This web service is hosted in the Partners domain of Microsoft. A Windows Forms application is the consumer of this web service. The client can call the web service in two scenarios that is the client can be a part of the Corporate Intranet or the client can be in some remote location and access the web service over RAS.

We pass the credentials to the Web Service call as belowâ€

1. WebServiceObject.Credentials = Credentials.DefaultCredentials(); --> This will be used if the client is in Intrane

2. WebServiceObject.Credentials = new NetworkCredentials(“UserIDâ€,â€Passwordâ€,â€Domainâ€); --> This will be used if the client is in extranet

Our Application has proper logic to determine if the client app is in Intranet or in Extranet

Now the problem that we face is, the credentials are not getting passed if we use the statement 2. We looked at the IIS Log from (C:\Windows\System32\LogFiles\...). Here from the log we saw that NULL credentials are getting passed.

The following is the IIS configuration which hosts the Web Service

1. OS --> Windows Server 200
2. IIS Ver --> 6.
3. Uses Application Pool
4. App Pool Identity --> “Local Systemâ€
5. Authentication on the Vir Dir --> “Integrated Windows†and “Digestâ€

Any pointers on what could be going wrong will be of great help. Please let us know, if we are missing some extra settings

*** Please mark a cc of the reply to (e-mail address removed) and (e-mail address removed) ***

Thanks & Regards
Ramjee Tangutu
Microsoft India Community Star (.NET
 
J

Jan Tielens

Do you use following line too?

WebServiceObject.PreAuthenticate = true;

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan


Ramjee Tangutur said:
Hi All
We have a web service (developed in C#). This web service is hosted in the
Partners domain of Microsoft. A Windows Forms application is the consumer of
this web service. The client can call the web service in two scenarios that
is the client can be a part of the Corporate Intranet or the client can be
in some remote location and access the web service over RAS.
We pass the credentials to the Web Service call as below.

1. WebServiceObject.Credentials = Credentials.DefaultCredentials(); -->
This will be used if the client is in Intranet
2. WebServiceObject.Credentials = new NetworkCredentials("UserID","
Password","Domain"); --> This will be used if the client is in extranet.
Our Application has proper logic to determine if the client app is in Intranet or in Extranet.

Now the problem that we face is, the credentials are not getting passed if
we use the statement 2. We looked at the IIS Log from
(C:\Windows\System32\LogFiles\...). Here from the log we saw that NULL
credentials are getting passed.
The following is the IIS configuration which hosts the Web Service.

1. OS --> Windows Server 2003
2. IIS Ver --> 6.0
3. Uses Application Pools
4. App Pool Identity --> "Local System"
5. Authentication on the Vir Dir --> "Integrated Windows" and "Digest"

Any pointers on what could be going wrong will be of great help. Please
let us know, if we are missing some extra settings.
*** Please mark a cc of the reply to (e-mail address removed) and
(e-mail address removed) ***
 
A

Alek Davis

Ramjee,

Not sure if this will help but try enabling basic authentication (you will
need to use it with SSL to prevent exposure of credentials). By the way, how
do you distinguish between intranet and extranet users (if this is not a
secret)? Thanks.

Alek

Ramjee Tangutur said:
Hi All
We have a web service (developed in C#). This web service is hosted in the
Partners domain of Microsoft. A Windows Forms application is the consumer of
this web service. The client can call the web service in two scenarios that
is the client can be a part of the Corporate Intranet or the client can be
in some remote location and access the web service over RAS.
We pass the credentials to the Web Service call as below:

1. WebServiceObject.Credentials = Credentials.DefaultCredentials(); -->
This will be used if the client is in Intranet
2. WebServiceObject.Credentials = new NetworkCredentials("UserID","
Password","Domain"); --> This will be used if the client is in extranet.
Our Application has proper logic to determine if the client app is in Intranet or in Extranet.

Now the problem that we face is, the credentials are not getting passed if
we use the statement 2. We looked at the IIS Log from
(C:\Windows\System32\LogFiles\...). Here from the log we saw that NULL
credentials are getting passed.
The following is the IIS configuration which hosts the Web Service.

1. OS --> Windows Server 2003
2. IIS Ver --> 6.0
3. Uses Application Pools
4. App Pool Identity --> "Local System"
5. Authentication on the Vir Dir --> "Integrated Windows" and "Digest"

Any pointers on what could be going wrong will be of great help. Please
let us know, if we are missing some extra settings.
*** Please mark a cc of the reply to (e-mail address removed) and
(e-mail address removed) ***
 

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,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top