Bug #69749 "Membership.Provider" property must be an instance of "ExtendedMembershipProvide
Submitted: 15 Jul 2013 14:16 Modified: 26 Sep 2014 21:36
Reporter: Emerson Matsumoto Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:6.7.4 OS:Microsoft Windows
Assigned to: Francisco Alberto Tirado Zavala CPU Architecture:Any
Tags: asp.net

[15 Jul 2013 14:16] Emerson Matsumoto
Description:
"Membership.Provider" property must be an instance of "ExtendedMembershipProvider"

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.InvalidOperationException: Para chamar esse método, a propriedade "Membership.Provider" deve ser uma instância de "ExtendedMembershipProvider".

Source Error: 

Line 80:                 try
Line 81:                 {
Line 82:                     WebSecurity.CreateUserAndAccount(model.UserName, model.Password);
Line 83:                     WebSecurity.Login(model.UserName, model.Password);
Line 84:                     return RedirectToAction("Index", "Home");

Source File: C:\Documents and Settings\emerson.matsumoto\Meus documentos\Visual Studio 2010\Projects\mysql\mysql\Controllers\AccountController.cs    Line: 82 

Stack Trace: 

[InvalidOperationException: Para chamar esse método, a propriedade "Membership.Provider" deve ser uma instância de "ExtendedMembershipProvider".]
   WebMatrix.WebData.WebSecurity.VerifyProvider() +62993
   WebMatrix.WebData.WebSecurity.CreateUserAndAccount(String userName, String password, Object propertyValues, Boolean requireConfirmationToken) +15
   mysql.Controllers.AccountController.Register(RegisterModel model) in C:\Documents and Settings\emerson.matsumoto\Meus documentos\Visual Studio 2010\Projects\mysql\mysql\Controllers\AccountController.cs:82
   lambda_method(Closure , ControllerBase , Object[] ) +162
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +205
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
   System.Web.Mvc.Async.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() +28
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +50
   System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +58
   System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +237
   System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) +12
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +50
   System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +24
   System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +126
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +45
   System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +14
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +61
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +49
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
   System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +28
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +49
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9030045
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1008

How to repeat:
in web.config

<membership>
      <providers>
        <remove name="MySQLMembershipProvider"/>
        <add name="MySQLMembershipProvider" autogenerateschema="true" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.7.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />
      </providers>
    </membership>
    <profile>
      <providers>
        <remove name="MySQLProfileProvider"/>
        <add name="MySQLProfileProvider" type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=6.7.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="DefaultConnection" applicationName="/" />
      </providers>
    </profile>
    <roleManager>
      <providers>
        <remove name="MySQLRoleProvider"/>
        <add name="MySQLRoleProvider" type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.7.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="DefaultConnection" applicationName="/" />
      </providers>
    </roleManager>

Suggested fix:
Entity Framework uses ExtendMembershipProvider instead MembershipProvider in MembershipProvider.cs.
[27 Feb 2014 21:29] Aleksandro Ribeiro
Please man, can you give me an explanation a little beat more detailed?
Sorry, I'm new with entity framework.

tks
[26 Aug 2014 21:36] Gabriela Martinez Sanchez
Hi Emmerson,

The WebSecurity.CreateUserAndAccount and WebSecurity.Login methods are used with the SimpleMembershipProvider which was not implemented yet in MySQL Connector/Net 6.7.4.
You can use the MySQLMembership provider with this version or you can use the MySQLSimpleMembership which has been added in the 6.9.3 version. 

You can download the 6.9.3 version here: 

http://dev.mysql.com/downloads/connector/net/

You can follow this tutorial with the steps for using the SimpleMembership
https://blogs.oracle.com/MySqlOnWindows/entry/how_to_using_simplemembserhipprovider_with

Please let us know if this works for you.

Thanks in advance.
[27 Sep 2014 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".