How to use umbraco membership provider in non-umbraco .NET MVC application?
Hi!
Can anyone tell me how can I user umbraco membership provider in other, non-umbraco .NET MVC project?
I have an Umbraco site and I've written a subapplication in standard .NET MVC in which I would like to user the same users from Umbraco site. I added UmbracoMembershipProvider to web.config and imported:
busineslogic.dll
cms.dll
interfaces.dll
umbraco.dll
umbraco.providers.dll
I don't want to create new members, just user login page with umbraco user credentials.
When I try to login in I get an error:
Message: "Object reference not set to an instance of an object." Source: "cms" StackTrace: " at umbraco.cms.businesslogic.member.Member.GetMemberFromLoginAndEncodedPassword(String loginName, String password)\r\n at umbraco.providers.members.UmbracoMembershipProvider.ValidateUser(String username, String password)\r\n at PyreePollsWeb.Controllers.AdminController.LogOn(FormCollection formCollection, String returnUrl) in D:\\pyree.pl\\SourceCode\\PyreePollsWeb\\Controllers\\AdminController.cs:line 91"
Then I think the problem comes from the value of the defaultMemberTypeAlias attribute, which is set to "Another Type". The value of that attribute should be the alias name of an actual member type in the Umbraco back-end.
In the Umbraco back-end, if you go to the "Members" section, one of the root nodes of the tree that appears is "Member Types". You should use the alias of an existing type, or else create e new member type, and use the alias as value of the attribute in the web.config.
This got me past the "object reference not set to an instance of an object" problem, but then I immediately get w3wp.exe errors and VS2010 trying to debug.
When I get into VS2010 it says
Cannot evaluate expression because the current thread is in a stack overflow state.
Would love to get this nailed...
I've tried using a standard, non-umbraco, membership database, and the page/login/everything works fine...
If anyone has a working example of this, it would be awesome if you could post a link to the code..
For those that are having issues with this, I got it working today, for a plain asp.net site.
I followed all the steps above, but also had to create a /config/umbracoSettings.config file.. mine was originally copied from another umbraco site, but then I started playing around with it and it's now blank... It seems that the file just needs to exist to stop the overflow issue..
I know this thread is old - but I had something similar working on v4 - but I'm not able to upgrade it to v6 :(
I'm not actually sure why I need to change anything - but the login fails if I leave the old versions of the libraries.
If I try to install just the UmbracoCms.Core package then my site randomly crashes after a short time with an error in Umbraco.Core.dll:
System.NullReferenceException was unhandled - Message: An unhandled exception of type 'System.NullReferenceException' occurred in Umbraco.Core.dll - Additional information: Object reference not set to an instance of an object.
How to use umbraco membership provider in non-umbraco .NET MVC application?
Hi!
Can anyone tell me how can I user umbraco membership provider in other, non-umbraco .NET MVC project?
I have an Umbraco site and I've written a subapplication in standard .NET MVC in which I would like to user the same users from Umbraco site. I added UmbracoMembershipProvider to web.config and imported:
Hi Natalia,
When adding the UmbracoMembershipProvider in your web.config, did you also add the "Umbraco specific" attributes, like MemberTypeAlias?
Cheers,
Michael.
Hi,
Thanks for your reply.
My membership section in web.config looks like this:
Hi Natalia,
Then I think the problem comes from the value of the defaultMemberTypeAlias attribute, which is set to "Another Type". The value of that attribute should be the alias name of an actual member type in the Umbraco back-end.
In the Umbraco back-end, if you go to the "Members" section, one of the root nodes of the tree that appears is "Member Types". You should use the alias of an existing type, or else create e new member type, and use the alias as value of the attribute in the web.config.
Hope this helps.
Cheers,
Michael.
Unfortunately that didn't help... I'm still getting the same error.
But thanks anyway.
Natalia,
Maybe a stupid question, but did you take over the database connection string in the web.config of your MVC sub-app?
Cheers,
Michael.
Hi,
Yes, I use the same connection string and it works - I've got access to other database tables.
Hi Natalia,
Did you ever figure this problem out..??
I had the same problem until I added in the following appSetting:
This got me past the "object reference not set to an instance of an object" problem, but then I immediately get w3wp.exe errors and VS2010 trying to debug.
When I get into VS2010 it says
Would love to get this nailed...
I've tried using a standard, non-umbraco, membership database, and the page/login/everything works fine...
If anyone has a working example of this, it would be awesome if you could post a link to the code..
Hi guys,
For those that are having issues with this, I got it working today, for a plain asp.net site.
I followed all the steps above, but also had to create a /config/umbracoSettings.config file.. mine was originally copied from another umbraco site, but then I started playing around with it and it's now blank... It seems that the file just needs to exist to stop the overflow issue..
Hope that helps..
Hi,
Can you send me the project you were able to run? I still have some issues... Maybe I'm doing something else wrong. Your code could help
sure... whats your email address...?? I couldn't get it from your profile...
Are you getting a new error..???
natalia.langa at gmail.com
It's an error with "umbraco.providers.members.UmbracoMembershipProvider" type of my UmbracoMembershipProvider.
i also got same error on Registeration page
login works super fine plz help
Thanks Michael
defaultMemberTypeAlias helped me sooooo much
Hi Mohsin,
Glad to hear that ;-)
Cheers,
Michael.
I know this thread is old - but I had something similar working on v4 - but I'm not able to upgrade it to v6 :(
I'm not actually sure why I need to change anything - but the login fails if I leave the old versions of the libraries.
If I try to install just the UmbracoCms.Core package then my site randomly crashes after a short time with an error in Umbraco.Core.dll:
System.NullReferenceException was unhandled - Message: An unhandled exception of type 'System.NullReferenceException' occurred in Umbraco.Core.dll - Additional information: Object reference not set to an instance of an object.
is working on a reply...