Sitecore – How to fix Login attempt leads to application crash when AD Module 1.3 is used

Avatar de Vinicius

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 SitecoreDevelopment ToolsInstallation 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

  • App_Config\ConnectionStrings.config
  • App_Config\Security\domains.config
  • 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:

  1. You can easily lose track on your customizations;
  2. Upgrading Sitecore for a newer version may become harder;
  3. 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.

Sitecore User Manager Active Directory AD Blog Vinicius Deschamps

AWESOME! Let’s check if I am able to sign-in using my user and password from Active Directory

Sitecore Login using Active Directory AD account Blog Vinicius Deschamps

Spinning, spinning…. and a Yellow Screen of Death shows up

Server Error in / Application The Provider User Key Active Directory Module Blog Vinicius Deschamps
Exception: System.ArgumentException
Message: The provider user key supplied is invalid. It must be of type System.Guid.
Parameter name: providerUserKey
Source: System.Web
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.Login()
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)
at System.Web.UI.Page.<ProcessRequestMainAsync>d__523.MoveNext()

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-1.3.0.0.zip

Sitecore Sitecore.Support.139945.dll Blog Vinicius Deschamps

3. Copy the DLL named Sitecore.Support.139945.dll into the bin folder, and overwrite existing files if any conflicts occur

Adding Sitecore Sitecore.Support.139945.dll bin folder Blog Vinicius Deschamps

4. Open the configuration file that has the <membership> section, which in my case is located in App_Config\AD\Membership.config

Sitecore App Config Active Directory Membership Config File Blog Vinicius Deschamps

5. Find the <membership> section, and look for

<add name=”switcher” type=”Sitecore.Security.SwitchingMembershipProvider, Sitecore.Kernel” applicationName=”sitecore” mappings=”switchingProviders/membership” />

Sitecore existing switcher parameter Blog Vinicius Deschamps

6. Replace the above line with

<add name=”switcher” type=”Sitecore.Support.Security.SwitchingMembershipProvider, Sitecore.Support.139945” applicationName=”sitecore” mappings=”switchingProviders/membership” />

Sitecore Replace Switcher Parameter Blog Vinicius Deschamps

7. Now, save the file

8. Access Sitecore login page, and use your Active Directory credentials

Sitecore Login using Active Directory AD account Blog Vinicius Deschamps

9. Voilá! YSoD is gone, and I’m logged in with my Active Directory credential

Sitecore Experience Platform Active Directory AD Blog Vinicius Deschamps

I hope you liked it, and thanks for reading!

I’ll see you on my next post!

Tagged in :

Avatar de Vinicius

9 respostas para “Sitecore – How to fix Login attempt leads to application crash when AD Module 1.3 is used”

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *