Anyone implemented the ASP.Net 2.0 identity with CSLA?

Anyone implemented the ASP.Net 2.0 identity with CSLA?

Old forum URL:

richardb posted on Friday, February 27, 2015

So I have my MVC project wired up using the latest ASP.Net identity and registration and login works fine. Now to wire into the Csla principal and am wondering how to do this.

How much of the ASP.Net identity bits and pieces can I realistically move into the DalEF project (I'm following the ProjectTracker solution here)?

Anyone tried to implement the SignInManager, UserManager, RoleManager in the Dal like the example simple web membership methods;

Membership.ValidateUser(username, password)


var user = Membership.GetUser(username);
var result = new UserDto { Username = username };
result.Roles = Roles.GetRolesForUser(result.Username);
return result;




JonnyBee replied on Friday, February 27, 2015


Just my opinion from having used CSLA for a long time and now also used ASP.NET Identity 2.x

I do not believe it is realistically possible to integrate ASP.NET Identity 2.x and CSLA in the same sense as the 1.x version. 

ASP.NET Identity 2.x requires that you use _their_ base classes and inherit from these.

So the only way to do this then - is to to have CslaIdentity and CslaPrincipal inherit from the base classes in ASP.NET Identity but then the CSLA DataPortal would not make much sense at all. So as I see it - You use ASP.NET Identity to secure an website and you must have a local database to achieve this. (Or at least - not depend on a remote DataPortal to handle the calls to the database).

In the end - that means the user and identity classes should inherit from the ASP.NET identity classes.

You _could_ implement your own UserManager class that uses CSLA classes to the data access - it's just a whole lot of classes and methods to implement that I do not see will give you much advantage. 




richardb replied on Friday, February 27, 2015

Yes I wasn't having much success.  Its useful if you want a quick out-of-the-box membership up and running.

Its looking like I need to roll some customization into it anyway, as I need to group logins by customer, limit the number of registrations per customer and product (e.g. max 60 licences allowed product A, 20 licences product B), and have subscription start and end dates.  I can extend ASP.Net identity to do this and control access, - I just need to bespoke the AccountController and ManageController template code they give you.

But I'll need to switch off parts of the UI if they don't have access anymore to a product - trial expired, etc.  So their "roles" will have expiration dates - sounds like I'm rolling my own custom access here.

Maybe just need a simple method on the DataPortal to load up the current "roles" so server-side checks can still run.

Thanks Jonny.




skagen00 replied on Friday, February 27, 2015

I did some work on this a long time ago.

I am not actively using this code, but it worked.



JonnyBee replied on Saturday, February 28, 2015

Way back (2007), that would be ASP.NET Identity 1.x

The question in this thread is about ASP.NET Identity 2.x and that is a different "beast" where the object model is based on an Entitiy Framework DbContext and base classes that you must inherit from.

skagen00 replied on Saturday, February 28, 2015

Sorry, my bad!  Not familiar with ASP.Net Identity 2.x.

Copyright (c) Marimer LLC