SiteUser vs. MembershipUser

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
6/16/2009 7:27:02 PM
Gravatar
Total Posts 26

SiteUser vs. MembershipUser

Hello Joe and community,

Upon digging deep into the mojoPortal code it seems that a hybrid system is being used to manage mojo's users.
Half of mojoPortal uses ASP.Net Membership Controls and the other half uses the entirly custom built business object SiteUser.

More Detailed Expalanation
MojoPortal uses ASP.Net Membership Controls (i.e. asp:CreateUserWizard, asp:ChangePassword, asp:PasswordRecovery, asp:Login) for registration, changing passwords, recoverying passwords and and logging in.

But, for everything else, MojoPortal uses a business object called SiteUser, (which doesn't inherit from MembershipUser) which allows access to database fields such as: userGUID, AIM, Occupation and Signature. Fields like these don't directly relate to authentication.

Differences

Beyond the major difference between the two, namely that SiteUser gives access to additional DB fields.

There are other differences:
* Programmatically, it doesn't seem possible to reset or change a password with SiteUser and ensure that future login's will work as expected. MembershipUser does have the ability to Reset a password with ResetPassword() method.

* While SiteUser does include a Password property, it just reads the value string from the database, whether it's encrypted or not.

* MembershipUser.UserName returns an email address, rather than the the user name the user chose during registration.

 

Question: Why doesn't SiteUser inherit from MembershipUser?  Are there advantages to this model?

 

 

thanks Joe,
Michael

6/17/2009 5:35:14 AM
Gravatar
Total Posts 18439

Re: SiteUser vs. MembershipUser

Hi Michael, 

mojoPortal implements the MembershipProvider but is not limited to its API. We implement this API to make it theoretically possible for developers to integrate other apps by making the other app use the mojoMembershipProvider but its not possible for mojoPortal to use some other MembershipProvider because internally we use our own business objects like SiteUser which keeps our internal api flexible and extendable.

In fact, the default MembershipProvider shipped by Microsoft is the SqlMembershipProvider, which internally talks to MS SQL. By contrast the mojoMembershipProvider does not talk directly to any db it uses SiteUser and siteSettings business classes plus some internal utility logic for encrypting/decrypting passwords. So our provider can support any dbs supported by our business objects.

The only places we actually use the MembershhipAPI internally is by using the Login control, CreateUserWizard, and PasswordRecovery controls which bind directly to MembershipProvider.

Hope it helps,

Joe

6/17/2009 11:32:32 AM
Gravatar
Total Posts 26

Re: SiteUser vs. MembershipUser

Hello Joe,

Thanks.

I understand that mojoPortal implements MembershipProvider in the class mojoMembershipProvider.  By choosing to create a custom membership provider you can use ASP.NET Membership controls such as <asp:CreateUserWizard>, <asp:ChangePassword>, <asp:PasswordRecovery>, <asp:Login> and still use your own database/datastore design.

And I also now understand that mojoMembershipProvider sits on top of SiteUser and SiteSettings.

But to re-phrase my question, just as mojoPortal uses a custom membership provider, wouldn't mojoPortal also logically implement a custom MembershipUser too?  (in other words, why doesn't SiteUser inherit from MembershipUser, to then support the additional fields that mojoPortal uses?)

Or are there advantages that I can't see with SiteUser as a stand alone class.

Does my question make sense in light of this article? http://msdn.microsoft.com/en-us/library/ms366730.aspx

thank you,

Michael

6/17/2009 11:41:51 AM
Gravatar
Total Posts 18439

Re: SiteUser vs. MembershipUser

SiteUser existed for a long time before Membership stuff came out ie, back in the .NET 1.1 days we already had SiteUser.

I don't see any real benefit that would result from making SiteUser inherit from MembershipUser. SiteUser exists in the Business project which has no references or dependencies on anything in System.Web. MembershipUser is a very web centric concept living in System.Web.Security namespace. It seems better to me not to introduce web stuff into the business layer if possible.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.