O'Reilly logo

Professional ASP.NET 3.5 Security, Membership, and Role Management with C# and VB by Stefan Schackow, Bilal Haidar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11.2. The MembershipUser Class

Regardless of whether you code against the static Membership class or directly against MembershipProviders, you will invariable deal with the MembershipUser class. The MembershipUser class is intended to be a lightweight representation of a user (though in retrospect it is just a tad bit too lightweight—hopefully, basic information such as first name, last name, and/or friendly name will be tacked on in a future release). The class is not intended to be an exhaustive or comprehensive representation of everything you would ever want to store about a user.

For ASP.NET 2.0 and ASP.NET 3.5, if you need to store more extensive information about a user, the usual approach is to leverage the Profile feature by defining the additional properties you need within the <profile /> configuration section. Alternatively, you can author a custom provider (perhaps deriving from an existing provider type) that works with a derived version of MembershipUser. Using the Profile feature is definitely the simpler of the two approaches. However, writing a custom provider and custom MembershipUser class is appropriate if you do not want to use the Profile feature in your website. For more about the different approaches used to extend the Membership provider model in ASP.NET 2.0 and ASP.NET 3.5, see the article at http://www.code-magazine.com/Article.aspx?quickid=0703071). It will give you a detailed explanation on how to set up a custom Membership provider that attaches ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required