I am facing this error, and I cannot figure it out. I send data to my controller through PostMan in Chrome, reaching the CreateUserAndAccount method and getting this error:
To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider".
Here is my controller:
[System.Web.Http.Authorize] [InitializeSimpleMembership] public class AccountController : ApiController {
I use the same InitializeSimpleMembershipAttribute class as the MVC SPA template:
{ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] public sealed class InitializeSimpleMembershipAttribute : ActionFilterAttribute { private static SimpleMembershipInitializer _initializer; private static object _initializerLock = new object(); private static bool _isInitialized; public override void OnActionExecuting(ActionExecutingContext filterContext) {
And in my web.config, I included simpleMembership:
<add key="enableSimpleMembership" value="true" />
What else could be?
Edit: I just tried the tip found at this link:
http://insomniacgeek.com/to-call-this-method-the-membership-provider-property-must-be-an-instance-of-extendedmembershipprovider/
And now I get
You must call the "WebSecurity.InitializeDatabaseConnection" method before you call any other method of the "WebSecurity" class. This call should be placed in the _AppStart.cshtml file in the root of your site.
Any suggestions would be great.
source share