Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Aug 31, 2012 03:29 PM by noamberda
Aug 30, 2012 05:48 AM|LINK
I would like to create my own custom membership provider that use the new ExtendedMembershipProvider. I am using VS 2012 and ASP.NET 4 with .NET4.0. I would like to use MongoDB instead of SQL and use the new OAuth that are coming with version 4.
Is it possible to define a custom provider when you use WebMatrix with ASP.NET4?
When i am creating my own provider based on ExtendedMembershipProvider and define it in the Web.config
<add name="MyProvider" type="MvcApplication3.Controllers.MyProvider" application ="/"/>
I am getting the following error
error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: This method cannot be called during the application's pre-start initialization phase.
Line 24: <providers>
Line 25: <clear/>
Line 26: <add name="MyProvider" type="MvcApplication3.Controllers.MyProvider" application ="/"/> Line 27: </providers>
Line 28: </membership>
I have tried to disable the SimpleMembershipProvider using the following setting. i though that then it might work.
<add key="enableSimpleMembership" value="false" />
But i am getting the following error
Aug 30, 2012 07:21 AM|LINK
Are you trying to build an MVC site with WebMatrix? If so, that won't work. MVC requires an additional compilation step that is not supported by WebMatrix.
Aug 30, 2012 12:24 PM|LINK
Thanks for the reply.
I am not building it with WebMatrix. I am using the Visual Studio 2012 template with MVC 4 (Not the Webmatrix site builder). It looks like Webmatrix.WebData is now part of MVC4 and this is the only way to use the ExtendedMembershipProider. isn't it the case?
What is the best practice to develop custom membership provider that is leverage the new OAuth capabilties of MVC 4?
When i am extending the standard MembershipProvider (from MVC 2) and trying to define it with the Web.Config i am getting the same error. It looks like when WebMatrix is getting initlized on the site startup its tryting to resolve the type define in the
Web.config and this is the cause of the error. But i am not sure.
Aug 30, 2012 01:49 PM|LINK
I'm planning on starting a GitHub project for exactly that tonight.
Although right now I'm a little confused as to what is the difference between ExtendedMembershipProvider and SimpleMembership and which one I should be implementing for Mongo.
Aug 31, 2012 10:47 AM|LINK
See if anything here helps: http://weblogs.asp.net/jgalloway/archive/2012/08/29/simplemembership-membership-providers-universal-providers-and-the-new-asp-net-4-5-web-forms-and-asp-net-mvc-4-templates.aspx
Aug 31, 2012 03:22 PM|LINK
Thanks for the link, it does explain the new concept of Membership managment in MVC 4.0 and .NET 4.5 but it does not solve the problem.
Looks like it is not possible at all to create custom membership provider with MVC 4 on .NET 4.0
its easy to reproduce.
1. Create MVC 4.0 project based on .NET 4.0
2. Create custom membership provider that doesnt do anything
3. Go to Web.config and add referece to the new membership provider (like in my original post)
4. Try to run the web application
5. You will get the exeption.
Can you give it a try and see if you get the same error i am getting?
Aug 31, 2012 03:29 PM|LINK
Ok just found the following discussion on stackoverflow