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.
Note: For a more detailed list, visit the API documentation
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 with 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 allocates for 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 with a given username, if found, returns a member profile as
Gets the current members login status as a
Get the currently logged in member as
Gets the current member profile as a
Gets the currently logged in member id, -1 if they are not logged in.
Returns a boolean to state 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