membership provider

membership provider

Old forum URL: forums.lhotka.net/forums/t/3741.aspx


Wilfred posted on Thursday, October 18, 2007

Hello,

I am trying to add ChangePassword functionality in my application.

The first problem I ran into was implementing the GetUser functionality.

This function is supposed to return MembershipUser. As I can't find any membershipuser in CSLA, can I implement one in the CustomIdentity used in PTWEB. And if it isn't fit inheriting from the MembershipUser that already exists in .net and implementing it in the custom identity.

Is this the only way to implement GetUser.

Thanks

Greetings.

Wilfred

skagen00 replied on Thursday, October 18, 2007

There's a large interface that you "could" build out for the Membership provider. One of the methods, as you have seen, is GetUser, which can return a MembershipUser instance. Via MembershipUser you can do all kinds of things, such as "ChangePassword". MembershipUser is a class used in the Membership API which has quite a few members. Some of the ASP.Net controls plug right into this Membership API. Obviously there's allure there.

In Rocky's book, this wasn't covered in great deal, as his book is really geared towards CSLA; it wouldn't make sense to walk through fully implementing a Membership provider.  

The approach I took was to leverage the built in providers within the .Net framework to take advantage of the full API without building it myself. The weakness with the providers AS-IS is that it assumes the items invoking the membership API are in a place that can directly access the database. This is not necessarily the case - if we utilize a remoting solution we will likely not have the Web server have capabilities to connect to the database.

So, I wrote a couple of clasess to wrap the functionality of the built-out providers which happen to leverage a Csla command class - to use the DataPortal, so that the API can execute on the application server.

The SqlServer providers are right in the .Net Framework - SqlMembershipProvider and SqlRoleProvider. One can download (I'm pretty sure) Oracle ones if that's your flavor.

The thread which contains my code is here:

http://forums.lhotka.net/forums/thread/14844.aspx

Alternatively, you can just skip out on using the Membership API -- just write out methods invoking Csla command classes to do various things like changing a password, etc. (I've also seen one implementation leverage a Csla "User" class with things such as "password" as members.)

For us, all of the built in implementation of the Membership and Role providers made it worth figuring out how to leverage them.

Good luck,

Chris

 

 

Copyright (c) Marimer LLC