Take the community feedback survey now.

Daniel Ovaska
Feb 20, 2013
  10329
(0 votes)

How to solve problems with the ActiveDirectoryMembershipProvider and similar ldap integrations

The basics is already handled in the EPiServer SDK about membershipprovider. But what do you do when that doesn’t work? Here are some ideas and tools how to get that integration up and running when the night is getting darker and the coffee is running out…

Basic setup of ActiveDirectoryMembershipProvider

Ok, so you read the guide above and you got a server adress to the customer AD and a user in AD to use to connect with. You have modified the web.config on the site similar to this:

web.config_membershipprovider

…and you added the connectionstring with IP or server name to connectionStrings.config like this:

ConnectionString

…but it doesn’t work? Example of errors are:


”Unable to establish secure connection with the server” or the more evil one
”The specified domain or server could not be contacted”.

Why? Ok, let’s get this article going.

Check that ip adress is reachable

My first simple step would be to ping that adress or IP. Maybe they gave you an internal server name instead of a reachable ip or reachable url?

pingIt

If ping fails, get back to the customer and let them hand you the correct ip or url.

Ok, so you get the correct ip adress of the server that you can ping. But it’s still not working? Now is the time to start downloading some additional tools. I would recommend starting with Softerra’s LDAP browser. Google it and download it. Maybe you have made some mistake on your LDAP connectionstring or the user credentials are wrong?

Testing connection to AD with Softerra LDAP browser

Booting up Softerra will give you a similar view to this. Fill in IP to test against…

IPtoAD

and user details…


FillInUserToTestWith

If you can browse in the AD with this tool, you now know that the both the IP and the user detail are correct.

If you got
InvalidCredentialsToAD
then you need to get in touch with the AD administrator and let him hand you the correct credentials.

You also know that the LDAP port 389 that this tool (and the ActiveDirectoryMembershipProvider) uses is open if you are able to browse in the AD at this time. It’s now time to check again if the website is able to login correctly. If not, maybe you are getting this error?

”The specified domain or server could not be contacted”

Nmap for solving firewall problems

Now it’s time to download your second tool, nmap with it’s gui part Zenmap. Google it, download it. Starting it will present you with a view similar to this

NetworkScanMogulAD

Insert your server adress at the top and hit scan. This will display a list of open ports that you can connect to on that server. The important ones that needs to be open for ActiveDirectoryMembershipProvider I’ve marked in yellow. They are 389 and 445 and yes, you need both of them.

If you don’t see port 445 in this list, this will likely generate the error
”The specified domain or server could not be contacted” when trying to login to your website.

Eureka! Contact your firewall administrators on your side and customer side and tell them to open this port, and lo, it works!

 

Conclusion

There are a couple of walls, some made of fire, that you can run into when setting up this type of integration. Hopefully the tools and information above should save a few hours for someone. Nmap is, by the way, also a most useful tool to locate similar integration problems when you have firewalls blocking your happiness.

The short checklist to success:

  • Make sure you get a valid server adress and not an internal one. Use ping to see if the server even exist from your point of view.
  • Check that both ports (389 and 445) are open between the servers (TCP). Use nmap to validate that this is true.
  • Test ldap user credentials and url using LDAP browser

Happy coding!

Feb 20, 2013

Comments

Please login to comment.
Latest blogs
A day in the life of an Optimizely OMVP - Opticon London 2025

This installment of a day in the life of an Optimizely OMVP gives an in-depth coverage of my trip down to London to attend Opticon London 2025 held...

Graham Carr | Oct 2, 2025

Optimizely Web Experimentation Using Real-Time Segments: A Step-by-Step Guide

  Introduction Personalization has become de facto standard for any digital channel to improve the user's engagement KPI’s.  Personalization uses...

Ratish | Oct 1, 2025 |

Trigger DXP Warmup Locally to Catch Bugs & Performance Issues Early

Here’s our documentation on warmup in DXP : 🔗 https://docs.developers.optimizely.com/digital-experience-platform/docs/warming-up-sites What I didn...

dada | Sep 29, 2025

Creating Opal Tools for Stott Robots Handler

This summer, the Netcel Development team and I took part in Optimizely’s Opal Hackathon. The challenge from Optimizely was to extend Opal’s abiliti...

Mark Stott | Sep 28, 2025

Integrating Commerce Search v3 (Vertex AI) with Optimizely Configured Commerce

Introduction This blog provides a technical guide for integrating Commerce Search v3, which leverages Google Cloud's Vertex AI Search, into an...

Vaibhav | Sep 27, 2025

A day in the life of an Optimizely MVP - Opti Graph Extensions add-on v1.0.0 released

I am pleased to announce that the official v1.0.0 of the Opti Graph Extensions add-on has now been released and is generally available. Refer to my...

Graham Carr | Sep 25, 2025