0
votes

I am building my first asp.net app from scratch. I have two different membership providers. One is a basic sql provider while the other is active directory. The user "role" is determined by how the user logs in. I want to use the Role Manager functionality of asp.net but I don't want to build the whole role provider part when I really don't have "roles" in my application, I have two membership types.

Is there a way to set the role of the user through the membership provider at login or in some way mark a logged in user as having been authenticated by sql or AD?

This is my first asp.net app, am I even thinking about this the right way?

2

2 Answers

0
votes

Roles and membership are two distinct things in asp.net.

On login you need to assign a flag to the user object which identifies how they logged in.

Then in

public override string[] GetRolesForUser(string username)

check that flag and return an appropriate role

0
votes

You are trying to use the roles in a manner they aren't designed for, and I'm afraid you'll have to have a role-provider for it to work.

Why not use the MembershipUser.ProviderName property to check what provider provided the users identity?