473,416 Members | 1,850 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

About the web service using Integrated windows authentication

Now I have a web application, a web service and a SQL Server database.

The Web application will invoke the web service, the web service
invokes the SQL Server stored procedure.

I let the web service run in an application pool which runs under a
domain user, this domain user has permissions of accessing database and the
connection to database is trusted connection. All these work well.

The web application will be used in internet (not in the intranet),
but the web service can only be used in intranet so I want to use the
integrated windows authentication for the web service, can I?

No I want to let the web application use the “Enable anonymous
access” and web service use the “integrated windows authentication”. If so,
when I use the web application to invoke the web service, I will receive the
“The request failed with HTTP status 401: Unauthorized. at
System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)”

I already used the following two ways in my web application code when
invoking web service:

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

(this method works only when the web application and web service are in the
same box, when I deployed the two in different computer, I still got the
error “The request failed with HTTP status 401”)

Or

System.Net.CredentialCache cache = new System.Net.CredentialCache();

cache.Add(new Uri(Proxy.Url), "Negotiate", new
System.Net.NetworkCredential("username", "pass", "domain"));

Proxy.Credentials = cache;

Could you please tell me if I use the “integrated windows
authentication” for the web service, how does the user’s certificate be
conveyed to web service? (the application user will be anyone in the
internet, will the web service know him)
Sincerely waiting for your feedback!
Dec 20 '06 #1
3 13746
Do you mean if i use the web application in internet , we can not use the
windows authentication, the web service which the application invokes dose
not use the windows authentication either.
Then can i impersonate a domain user by using the following settings in
web.config of web application:

<identity impersonate="true"

userName="registry:HKLM\SOFTWARE\LCA_CONTRACT_ROUT ING\identity\ASPNET_SETREG,userName"

password="registry:HKLM\SOFTWARE\LCA_CONTRACT_ROUT ING\identity\ASPNET_SETREG,password"
/>
and pass the domain user and password to web service(using windows
authentication) by using:
System.Net.CredentialCache cache = new System.Net.CredentialCache();
cache.Add(new Uri(Proxy.Url), "Negotiate", new
em.Net.NetworkCredential("username", "pass", "domain"));
Proxy.Credentials = cache;


"Peter Ritchie [C# MVP]" wrote:
If your web application is being called over the Internet, outside the
domain, where do you expect domain credentials to come from? Integrated
Windows authentication just takes the user credentials that the browser
supplies. If that browser is on the Internet (outside the domain) the
credentials will be unknown to that domain an won't be granted access.

Proxy.Credentials is only used if you're accessing the web via a
proxy--which is probably why it worked when both computers were within the
domain. My guess it would also work if you deleted the line setting
Proxy.Credentials because it doesn't apply.

If you expect users of your web service to be outside the domain (i.e. not
logged into it) you can't use integrated windows authentication, you'll have
to use some other method of accepting/validating credentials.

--
Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"Dandan Zhang" wrote:
Now I have a web application, a web service and a SQL Server database.

The Web application will invoke the web service, the web service
invokes the SQL Server stored procedure.

I let the web service run in an application pool which runs under a
domain user, this domain user has permissions of accessing database and the
connection to database is trusted connection. All these work well.

The web application will be used in internet (not in the intranet),
but the web service can only be used in intranet so I want to use the
integrated windows authentication for the web service, can I?

No I want to let the web application use the “Enable anonymous
access” and web service use the “integrated windows authentication”. If so,
when I use the web application to invoke the web service, I will receive the
“The request failed with HTTP status 401: Unauthorized. at
System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)”

I already used the following two ways in my web application code when
invoking web service:

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

(this method works only when the web application and web service are in the
same box, when I deployed the two in different computer, I still got the
error “The request failed with HTTP status 401”)

Or

System.Net.CredentialCache cache = new System.Net.CredentialCache();

cache.Add(new Uri(Proxy.Url), "Negotiate", new
System.Net.NetworkCredential("username", "pass", "domain"));

Proxy.Credentials = cache;

Could you please tell me if I use the “integrated windows
authentication” for the web service, how does the user’s certificate be
conveyed to web service? (the application user will be anyone in the
internet, will the web service know him)
Sincerely waiting for your feedback!
Dec 25 '06 #2
Do you mean if i use the web application in internet , we can not use the
windows authentication, the web service which the application invokes dose
not use the windows authentication either.
Then can i impersonate a domain user by using the following settings in
web.config of web application:

<identity impersonate="true"

userName="registry:HKLM\SOFTWARE\LCA_CONTRACT_ROUT ING\identity\ASPNET_SETREG,userName"

password="registry:HKLM\SOFTWARE\LCA_CONTRACT_ROUT ING\identity\ASPNET_SETREG,password"
/>
and pass the domain user and password to web service(using windows
authentication) by using:
System.Net.CredentialCache cache = new System.Net.CredentialCache();
cache.Add(new Uri(Proxy.Url), "Negotiate", new
em.Net.NetworkCredential("username", "pass", "domain"));
Proxy.Credentials = cache;
"Peter Ritchie [C# MVP]" wrote:
If your web application is being called over the Internet, outside the
domain, where do you expect domain credentials to come from? Integrated
Windows authentication just takes the user credentials that the browser
supplies. If that browser is on the Internet (outside the domain) the
credentials will be unknown to that domain an won't be granted access.

Proxy.Credentials is only used if you're accessing the web via a
proxy--which is probably why it worked when both computers were within the
domain. My guess it would also work if you deleted the line setting
Proxy.Credentials because it doesn't apply.

If you expect users of your web service to be outside the domain (i.e. not
logged into it) you can't use integrated windows authentication, you'll have
to use some other method of accepting/validating credentials.

--
Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"Dandan Zhang" wrote:
Now I have a web application, a web service and a SQL Server database.

The Web application will invoke the web service, the web service
invokes the SQL Server stored procedure.

I let the web service run in an application pool which runs under a
domain user, this domain user has permissions of accessing database and the
connection to database is trusted connection. All these work well.

The web application will be used in internet (not in the intranet),
but the web service can only be used in intranet so I want to use the
integrated windows authentication for the web service, can I?

No I want to let the web application use the “Enable anonymous
access” and web service use the “integrated windows authentication”. If so,
when I use the web application to invoke the web service, I will receive the
“The request failed with HTTP status 401: Unauthorized. at
System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)”

I already used the following two ways in my web application code when
invoking web service:

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

(this method works only when the web application and web service are in the
same box, when I deployed the two in different computer, I still got the
error “The request failed with HTTP status 401”)

Or

System.Net.CredentialCache cache = new System.Net.CredentialCache();

cache.Add(new Uri(Proxy.Url), "Negotiate", new
System.Net.NetworkCredential("username", "pass", "domain"));

Proxy.Credentials = cache;

Could you please tell me if I use the “integrated windows
authentication” for the web service, how does the user’s certificate be
conveyed to web service? (the application user will be anyone in the
internet, will the web service know him)
Sincerely waiting for your feedback!
Dec 25 '06 #3
Hi,
You will find following two links useful which addresses the issues faced by
you:
http://odetocode.com/Blogs/scott/arc...2/24/1053.aspx
http://msdn.microsoft.com/library/de..._asp_pages.asp

Thanks and Regards,
Manish Bafna.
MCP and MCTS.

"Dandan Zhang" wrote:
Now I have a web application, a web service and a SQL Server database.

The Web application will invoke the web service, the web service
invokes the SQL Server stored procedure.

I let the web service run in an application pool which runs under a
domain user, this domain user has permissions of accessing database and the
connection to database is trusted connection. All these work well.

The web application will be used in internet (not in the intranet),
but the web service can only be used in intranet so I want to use the
integrated windows authentication for the web service, can I?

No I want to let the web application use the “Enable anonymous
access” and web service use the “integrated windows authentication”. If so,
when I use the web application to invoke the web service, I will receive the
“The request failed with HTTP status 401: Unauthorized. at
System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)”

I already used the following two ways in my web application code when
invoking web service:

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

(this method works only when the web application and web service are in the
same box, when I deployed the two in different computer, I still got the
error “The request failed with HTTP status 401”)

Or

System.Net.CredentialCache cache = new System.Net.CredentialCache();

cache.Add(new Uri(Proxy.Url), "Negotiate", new
System.Net.NetworkCredential("username", "pass", "domain"));

Proxy.Credentials = cache;

Could you please tell me if I use the “integrated windows
authentication” for the web service, how does the user’s certificate be
conveyed to web service? (the application user will be anyone in the
internet, will the web service know him)
Sincerely waiting for your feedback!

Dec 26 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: epaetz | last post by:
I'm getting Not associated with a trusted SQL Server connection errors on a .Net windows service I wrote, when it's running on my application server. It's not a problem with mixed mode...
2
by: Craig | last post by:
Hope this is the right group, first timer - Just got back from holiday to find our Dev Server (Standard 2003, All hotfixes up to date) has been patched with KB 867460 (.NET Framework 1.1 Service...
2
by: Kumar | last post by:
I have a VB 6 COM object that uses ADO 2.6 to connect to a database. I have a Web Service that references this COM object and calls a method in this objects that uses ADO 2.6 to connect. The Web...
0
by: John Bown | last post by:
This query is similar to some others on this discussion group, but none of them were resolved! Can anybody help: The issue is related to integrated authentication. First I'll describe a simple...
1
by: Rosi | last post by:
Hi, I am having web service with number of methods. We are using integrated windows authentication for this web service. This service is working fine with integrated windows authentication.
0
by: brettburbidge | last post by:
I building a windows application that when opened uses IIS to authenticate the user against a custom database. When the application starts it contacts the Web Service to login. Right now I am...
4
by: =?Utf-8?B?VGFrdW1p?= | last post by:
I have a ASP.NET web page that calls a web service on a server with IIS installed on it. When it calls the web service, it gives a HTTP status 401 error stating that it is unauthorized to call the...
0
by: JeremyPollack | last post by:
Here's the situation : I have the same ASP.NET 2.0 web application running on both Machine A and Machine B. On both machines, I have Integrated Windows Authentication turned on, and Anonymous...
10
by: Ben | last post by:
I'm trying to access a c# web service from a web form. I set up the web reference proxy object as follows: proxy.PreAuthenticate = true; proxy.Credentials = CredentialCache.DefaultCredentials;...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.