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

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.

1

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

2.png

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

3.png

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

4

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

5

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

6

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

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

7.png

6. Replace the above line with

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

8.png

7. Now, save the file

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

2

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

9.png

I hope you liked it, and thanks for reading!

I’ll see you on my next post!

Advertisements

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

  1. Nice post. I was checking constantly this weblog and I am impressed! Very useful information particularly the closing part 🙂 I handle such info much. I used to be seeking this particular info for a very long time. Thank you and best of luck.

    Like

  2. Pingback: Sitecore Active Directory Module 1.3 setup guide | Sitecore notes - Stelio Di Bello

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s