I took over an existing application from an external company. They were not available for us anymore, so we only had the source code on our server. I copied all the c-sharp files and created a new webpage project in my VS 2005. When I built the application it worked fine (after some customization), but when it came to access to Active Directory I always got the following error message:
“The specified domain either does not exist or could not be contacted.”
I wondered why it worked on the server and so I searched around. I found 2 tips which finally fixed the problem:
1. I created a default webapplication in IIS, and by default anonymous access to the webpage is enabled. When trying to access AD, the anonymous account is of course not found. So I disabled anonymous account.
2. In web.config I enabled impersonation with this line: <identity impersonate=”true”> within <system.web>
And now my application runs fine!