Search code examples
asp.netazureactive-directoryldapmembership-provider

Active Directory membership provider using LDAP


I am working on a school assignment where we handle logins to a web application written in asp.NET using Active Directory. Our Active Directory is installed on a virtual machine on Azure.

When trying to login, I am presented with the following error: https://i.sstatic.net/B36g8.png

I have checked my connection string multiple times, and can't seem to get it to work.

Currently, I have the following connection string:

<add name="ADConnectionString" connectionString="LDAP://ictforevents1.cloudapp.net/DC=ictforevents1,DC=cloudapp,DC=net" />

The DNS name assigned to our virtual machine is ictforevents1.cloudapp.net, which is also the domain I set up in the Active Directory setup wizard.

Using the data in the connection string above, I can connect to the AD using LDAP Admin.

How to fix the error?


Solution

  • I fixed the issue by replacing the domain with the IP address in the connection string. From what I could find, asp will always always try to use a secure connection, even when using the insecure port (389). It will not attempt this when an IP address is given.

    My new connection string is:

    <add name="ADConnectionString" connectionString="LDAP://23.97.173.160:389/CN=Users,DC=ictforevents1,DC=cloudapp,DC=net" />
    

    While this is not ideal, because the server does not have a static IP, it's better than not working at all.