I am using the built-in SimpleMembership of the ASP.net MVC4 template and want to create an admin panel for reset passwords and similar user-based operations.
I use SecurityGuard.MVC4 nuget as a starting point, and I get a NotSupportedException for most actions. SecurityGuard uses the Controller's Membership property to call methods such as GetAllUsers (), GetUser (), and ResetPassword () on a SimpleMembershipProvider, and they all throw a NotSupportedException. From the documentation, it seems like this is by design:
SimpleMembershipProvider.GetAllUsers
Note. If the SimpleMembershipProvider class was initialized using a call to the WebSecurity.InitializeDatabaseConnection () method, this method is not supported and will throw a NotSupportedException exception. However, if the WebSecurity.InitializeDatabaseConnection () method was not called, and if you configured your site to use the standard ASP.NET membership provider, this method is passed through the standard membership provider.
What am I missing? It seems I need to choose between using WebSecurity for standard materials like WebSecurity.CreateUser () and using the provider directly?
I can get around this, but I'm confused in the first place, why can't I get both?