Annoyances.org
Home » Windows Server 2003 Discussion Forum » Message 1182956355 Search | Help | Home
  
"401 Not Authorized" error when authenticating a web service
Wednesday, June 27, 2007 at 7:59 am
Windows Server 2003 Annoyances Discussion Forum
Posted by afroblanco (1 messages posted)


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 
Access turned off for the folder that contains the webservice .ASMX file.  When I 
hit a certain page on Machine A, it will call the web service on Machine A, and then 
it will call the same web service on Machine B.  Likewise, when I hit the same page 
on Machine B, it will call the web service on Machine B, and then it will call the 
same web service on Machine A.




On both machines, I have an account set up for this web service to use. The username/password for Machine A is different from the username/password for Machine B. The machines are on different Active Directory domains. The websites on Machine A and Machine B use the same second-level domain, but have different subdomains - Machine A is local.mysite.com, Machine B is www.mysite.com. Both Machine A and Machine B are running Windows Server 2003.


On the page that calls the webservice, I have a block of code that looks like this : try {//call the webservice on Machine A CacheMaintenance maintain = new CacheMaintenance("local.mysite.com"); maintain.Credentials = new NetworkCredential("LocalLoginName", "LocalPassword", "LocalDomain"); maintain.FlashTheCache(); maintain.Dispose(); } catch (Exception exp) { errors = "Could not flash local cache. " + General.UnrollException(exp) + " "; } try {//call the webservice on Machine B CacheMaintenance maintain = new CacheMaintenance("wwww.mysite.com"); maintain.Credentials = new NetworkCredential("LiveLoginName", "LivePassword", "LiveDomain"); maintain.FlashTheCache(); maintain.Dispose(); } catch (Exception exp) { errors += "Could not flash live cache. " + General.UnrollException(exp); } Machine A has no problem calling the webservice on Machine B. Likewise, Machine B has no problem calling the webservice on Machine A. However, when Machine A tries to call the webservice on Machine A, or when Machine B tries to call the webservice on Machine B, I get a "401 Not Authorized" error. Does anybody know why I'm getting this error? I've tried using Digest Authentication instead of Integrated Windows Authentication, and Digest Authentication seems to work fine. However, it seems that Digest Authentication is less secure then Integrated Windows Authentication, thus I would like to make Integrated Windows Authentication work. Also, I should mention that I've only had this problem with Windows Server 2003. I have not had this problem with Windows Server 2000. Thanks for your help.



There are presently no replies to this message.

All messages in this thread [show all]
*"401 Not Authorized" error when authenticating a web service (afroblanco: Wed, Jun 27, 2007, 7:59 am)
Return to the Windows Server 2003 Discussion Forum

All content at Annoyances.org is Copyright © 1995-2008 Creative Elementtm All rights reserved.
Please do not plagiarize; redistributing these pages without permission is strictly prohibited.