Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

401 Not Authorized error when authenticating Web Service

Status
Not open for further replies.

afroblanca

Programmer
Jul 15, 2005
67
US
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
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(" 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.
 
since it works on 2000 and not 2003 I would check with with AD or OS forums.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top