Yesterday I had to install the Active Directory module in a Sitecore 8.2 instance by following the official documentation and the Best way to setup Active Directory Module in a Sitecore Solution from my colleague and Sitecore MVP Rodrigo Peplau.
The installation was pretty straight-forward, after download the module I went to Sitecore desktop, clicked Sitecore, Development Tools, Installation Wizard, uploaded the package and the Installation Wizard guided me through the installation process.
Once the package is installed, you must modify the following configuration files
- Web.config file
I’d not recommend to modify web.config file right away, as accordingly to Rodrigo Peplau may be a problem for serveral reasons:
- You can easily lose track on your customizations;
- Upgrading Sitecore for a newer version may become harder;
- During development you may be forced to turn your LDAP module off, basically undoing the setup of your provider, which is not straight-forward
And following his advice, everything went smoothly and as expected I was able to see the users list populated from Active Directory.
AWESOME! Let’s check if I am able to sign-in using my user and password from Active Directory
Spinning, spinning…. and a Yellow Screen of Death shows up
Message: The provider user key supplied is invalid. It must be of type System.Guid.
Parameter name: providerUserKey
at System.Web.Security.SqlMembershipProvider.GetUser(Object providerUserKey, Boolean userIsOnline)
at Sitecore.Security.SwitchingMembershipProvider.GetUser(Object providerUserKey, Boolean userIsOnline)
at Sitecore.Data.DataProviders.NullRetryer.Execute[T](Func`1 action, Action recover)
at Sitecore.Security.SitecoreMembershipProvider.GetUser(Object providerUserKey, Boolean userIsOnline)
at Sitecore.Security.Authentication.AuthenticationHelper.ParseUserName(String userName)
at Sitecore.Security.Authentication.DefaultAuthenticationManager.GetUserName(String rawUserName)
at Sitecore.Security.Authentication.DefaultAuthenticationManager.Login(String userName, String password, Boolean persistent)
at Sitecore.sitecore.login.Default.LoginClicked(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
Luckily I’ve found a Sitecore article that guided me through the solution as seems that the issue is already known.
Fixing the issue
1. First thing to do is backup the bin folder, and the file which holds that <membership> section
Please note that <membership> section by default is in Web.config but if you followed the tips from Rodrigo Peplau your membership section will be in a separate file, so backup accordingly your scenario.
2. Download and extract the Sitecore.Support.139945-184.108.40.206.zip
3. Copy the DLL named Sitecore.Support.139945.dll into the bin folder, and overwrite existing files if any conflicts occur
4. Open the configuration file that has the <membership> section, which in my case is located in App_Config\AD\Membership.config
5. Find the <membership> section, and look for
<add name=”switcher” type=”Sitecore.Security.SwitchingMembershipProvider, Sitecore.Kernel” applicationName=”sitecore” mappings=”switchingProviders/membership” />
6. Replace the above line with
<add name=”switcher” type=”Sitecore.Support.Security.SwitchingMembershipProvider, Sitecore.Support.139945” applicationName=”sitecore” mappings=”switchingProviders/membership” />
7. Now, save the file
8. Access Sitecore login page, and use your Active Directory credentials
9. Voilá! YSoD is gone, and I’m logged in with my Active Directory credential
I hope you liked it, and thanks for reading!
I’ll see you on my next post!