Can SimpleMembership be used with EF model-first? When I try it, I get \"Unable to find the requested .NET Framework Data Provider\" when
That's a bug in MVC 4. There's a workaround in this blog post.
As an action filter,
InitializeSimpleMembershipAttribute
hooks intoOnActionExecuting
to perform the lazy initialization work, but this can be too late in the life cycle. The Authorize attribute will need the providers to be ready earlier if it needs to perform role based access checks (duringOnAuthorization
). In other words, if the first request to a site hits a controller action like the following:
[Authorize(Roles="Sales")]
.. then you’ll have an exception as the filter checks the user’s role but the providers aren’t initialized.
My recommendation is to remove ISMA from the project, and initialize WebSecurity during the application start event.