U4-381 - When MemberType Alias does not Exist

Created by Sebastiaan Janssen 19 Aug 2012, 14:51:38 Updated by Shannon Deminick 21 Jun 2017, 07:52:13

Currently, if the defaultMemberTypeAlias which is set in the web config references a value which does not exist, a null exception is thrown when creating a new Member.

This means if this value is incorrect, this value is passed all the way down to the database, until SQL fails.

A real world example of this, is;

You create a website, with a MemberTypeAlias of 'Recipe Lovers'. You then make a nice form so they can join.

You set this value in the web.config, and everything works fantastically, you/everyone, the whole world is happy.

Then a user installs Contour, which updates the defaultMemberTypeAlias to "Another Type", this then breaks all membership forms, but as the error is a null expection, it's a little bit of a pig to trace.

It would be lovely, if there was a check against the defaultMemberTypeAlias, to confirm it exists, before then processing this.

If it doesn't exist, a nice message could be thrown such as "MemberTypeAlias within web.config is incorrect/does not exist".


Currently the code check there is a value (which is great!) but does not check it exists.

Laurie (:

''Originally created on CodePlex by [uniquelau|http://www.codeplex.com/site/users/view/uniquelau]'' on 3/30/2011 8:09:07 PM [Codeplex ID: 30207 - Codeplex Votes: 3]

Imported comments

''Comment by [uniquelau|http://www.codeplex.com/site/users/view/uniquelau] on 3/30/2011 8:15:59 PM:'' Further to this;

So it's UmbracoMembershipProvider.Initialize() doesn't check the config value "defaultMemberTypeAlias" exists and just assigns it to m_DefaultMemberTypeAlias. This then causes this bit of the CreateUser method to throw a null ref exception:

Member m = Member.MakeNew(username, email, MemberType.GetByAlias(this.m_DefaultMemberTypeAlias), User.GetUser(0));

Because MemberType.GetByAlias returns null.


Shannon Deminick 21 Jun 2017, 07:52:14

Closing issue due to inactivity - see blog post for details https://umbraco.com/blog/issue-tracker-cleanup/

Priority: Normal

Type: Bug

State: Closed


Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version:


Story Points: