FAQ - Umbraco

Question
Setting up Umbraco to use the built-in .NET membership provider
Answer

In Umbraco version 4, a lot of the old membership classes and methods were made obsolete in favour of the built in ASP.NET membership provider tools. The good folks at Umbraco now suggest using the .NET membership provider and methods for accessing data. Configuring Umbraco to let you do this is not yet very well documented, so here is a simple snippet of code that helped us get it off the ground.

Copy and paste the below code into your web.config file in the <system.web> element. For usability it's easiest to have it just below the <membership> element:

<profile  defaultProvider="UmbracoMemberProfileProvider"  enabled="true">
       <providers>
         <clear  />
         <add  name="UmbracoMemberProfileProvider"  type="umbraco.providers.members.UmbracoProfileProvider, umbraco.providers"/>
       </providers>
       <properties>
         <clear  />
  <add  name="customPropertyAliasOne"  allowAnonymous="false"  provider="UmbracoMemberProfileProvider"  type="System.String"  />
       </properties>
</profile>

Now you will need to tell .NET about each of your custom properties you made in Umbraco; note the following code:

  <add  name="customPropertyAliasOne allowAnonymous="false"  provider="UmbracoMemberProfileProvider"  type="System.String />

The name should correspond to the Alias of the property you are describing, and the type should correspond to the C# primitive type that your data will take.

Note:

You might need to tell Umbraco what your default member type alias is so when you create a user it automatically adds it to the correct role. Do this by adding the following attribute defaultMemberTypeAlias="AvaPATrial" to the "UmbracoMembershipProvider" key added inside the <membership><providers></providers></membership> element

If you found this information useful, please share it!


This FAQ was last updated on Wednesday, September 30, 2015

Contact Information

To find out more about Ava solutions you can contact us in a number of ways:
Follow Us...