Iis – “Access Denied” when trying to connect to remote IIS server from the local workstation

iiswindows-server-2003windows-xp

I am currently writing an application that connects to IIS server and spiders through the virtual directory to collection information. When I try to connect from a Windows XP SP3 with IIS 5.1 machine to a Windows Servers 2003 server with IIS 6.0 I get an "Access Denied" exception.

In the server's security event log it shows that I am trying to establish a connection as my local workstation's ASPNET account. I am an administrator on both machines and it does not seem to play a factor with trouble shooting the issue.

I posted this SO question on 4/1 and did not get anywhere. Maybe posting it on SF will provide better insight and trouble shooting.

Best Answer

In the discussion on StackOverflow you mentioned that it works when you run it as a standalone C# application, but not when you run it as a web application.

That makes sense. When you run it as a standalone C# application, it is running with your identity. When you run it through a web application, it is running using whatever identity you have configured for anonymous web requests under IIS, in this case, that local workstation's ASPNET account.

Depending on the security situation, you either want to

(1) configure the local web server so that that application serves anonymous web requests using a different account, one that has appropriate permissions on the server, or

(2) configure the local web server to not allow anonymous web requests. You will have to log on to the web page through your web browser using the username-password associated with an account that has appropriate permissions on the server