Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Commerce manager login fails: Default Membership Provider must be specified.

Vote:
 

Hi,

I'm having issues when I try to login directly into commercemanager.

What works:
-Logging in locally in CMS and navigate to the commercemanager -> I do not need to log in and can use commerce manager without problems.

What doesn't:
-I navigate to the commercemanager in an incognito screen, I get the login form. After trying to login I get a "Default membership provider must be specified" error 
-Logging in on our azure test environment in CMS and navigate to the commercemanager: I get the same "Default membership provider must be specified" error

Default Membership Provider must be specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Configuration.Provider.ProviderException: Default Membership Provider must be specified.

Source Error: 


An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[ProviderException: Default Membership Provider must be specified.]
   System.Web.Security.Membership.Initialize() +575
   System.Web.Security.Membership.get_Provider() +9
   Mediachase.Commerce.Manager.Login.LoginCtrl_Authenticate(Object sender, AuthenticateEventArgs e) +291
   System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +109
   System.Web.UI.WebControls.Login.AttemptLogin() +119
   System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +75
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +120
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +166
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +31
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3458

We use CMS 11.18 and Commerce 12.17.1

We are using aspnetidentity. this is our Owinstartup class in commerce manager:

using Frucon.CommerceManager;

using Microsoft.Owin;

[assembly: OwinStartup(typeof(OwinStartupCommerceManager))]

namespace Frucon.CommerceManager
{
    using System;
    using System.Linq;
    using System.Web.Configuration;

    using EPiServer.Cms.UI.AspNetIdentity;
    using EPiServer.ServiceLocation;

    using Frucon.Shared.Models.Entities;

    using Mediachase.Data.Provider;

    using Microsoft.AspNet.Identity;
    using Microsoft.AspNet.Identity.Owin;
    using Microsoft.Owin;
    using Microsoft.Owin.Security.Cookies;

    using Owin;

    public class OwinStartupCommerceManager
    {
        private readonly IConnectionStringHandler connectionStringHandler;

        public OwinStartupCommerceManager() : this(ServiceLocator.Current.GetInstance<IConnectionStringHandler>())
        {
            // Parameterless constructor required by OWIN.
        }

        public OwinStartupCommerceManager(IConnectionStringHandler connectionStringHandler)
        {
            this.connectionStringHandler = connectionStringHandler;
        }

        public void Configuration(IAppBuilder app)
        {
            app.AddCmsAspNetIdentity<SiteUser>(new ApplicationOptions
            {
                ConnectionStringName = this.connectionStringHandler.Commerce.Name
            });

            // Enable the application to use a cookie to store information for the signed in user
            // and to use a cookie to temporarily store information about a user logging in with a third party login provider.
            // Configure the sign in cookie.
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Apps/Shell/Pages/Login.aspx"),
                Provider = new CookieAuthenticationProvider
                {
                    // Enables the application to validate the security stamp when the user logs in.
                    // This is a security feature which is used when you change a password or add an external login to your account.  
                    OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager<SiteUser>, SiteUser>(
                        validateInterval: TimeSpan.FromMinutes(30),
                        regenerateIdentity: (manager, user) => manager.GenerateUserIdentityAsync(user)),
                    OnApplyRedirect = context => context.Response.Redirect(context.RedirectUri)
                }
            });
        }
    }
}

Any idea what could go wrong?

Thanks in advance,

Brecht Vanneste

#202993
Apr 05, 2019 13:20
Vote:
 

It looks like you need to update your Apps/Shell/Pages/Login.aspx

Basically the entire <asp:Panel ID="RegisterPanel" Visible="false" runat="server"> section should be removed if it is there. And to update the Inherits attribute to your custom code behind instead of the default one (Mediachase.Commerce.Manager.Login)

#202994
Apr 05, 2019 13:32
Vote:
 

What do you have in your web.config for

<membership>
  <providers>
    <clear/>
  </providers>
</membership>

?

#202995
Apr 05, 2019 13:33
Vote:
 

Quan Mai, updating the intherits attribute did the trick.
It got replaced by the default one when updating the nuget packages.

Thanks for the fast responses!

#202997
Apr 05, 2019 14:50
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.