MembershipHelper is a helper class for accessing member data in the form of
MembershipHelper has a variety of helper methods that are useful when working in your views, controllers and webforms classes.
How to reference MembershipHelper?
When working in templating, this helper will automatically be there for you to use as
@Members which means you conveniently in your templates easily can access member data:
If you need a
MembershipHelper in a custom class, service, view, etc... you can easily create one using this syntax:
var memberShipHelper = new Umbraco.Web.Security.MembershipHelper(Umbraco.Web.UmbracoContext.Current);
ProfileModel and IPublishedContent
When looking up Members, member data is returned as
IPublishedContent, which is the same format used for Content and Media, so referencing member properties should
be the exact same api as with those.
When looking at the currently logged in Member, you will get a
ProfileModel back, which contains the same data, by with additional methods and properties available
which are specific to members.
Looks for a member with a given email, If found, returns a member profile as
Looks for a member withe a given node ID, If found, returns a member profile as
looks for a member with a given provider key, If found, returns a member profile as
IPublishedContent. Provider key, is the key, that
the membership provider responsible for the member has assigned the member as its primary key.
Umbraco's default membership provider assigns a guid, alternative providers such as active directive likely uses another format.
Looks for a member withe a given username, If found, returns a member profile as
Gets the current members login status as a
Gets the current member profile as a
Returns a boolean whether there is a Member currently logged in.
.Login(string username, string password)
Attempts to log in a member with the given username and password
Determines if a member is authorized, based on memberType, associated roles, and member ID.
Detects if the default Umbraco membership provider is in use.
Registers a new Member
Updates a current member profile