I have an ASP.NET MVC application where I need to allow clients to configure MembershipProviders based on their environment, but still be able to map this MemberhipUser to a specific user model in our database.
Membership.GetUser()will give me access to a registered user Membership.ProviderUserKey. I can use this to communicate with a user post. Our custom SQL provider will simply return User.Id, but AD is a completely different story. In this case ProviderUserKeyis IdentityReference.
These searches will happen very often, as you might imagine (although caching can help reduce search at the database level).
I cannot decide which route is better: Store the SID as a varbinary or varchar column. This column will not be a primary key and will not have a clustered index. Knowing that I can index strings very well, and reading the SID in string format is definitely better than binary. Anyone who wants to share how they solved this situation?
Update
I don’t know how I skipped this SO question when I searched before I sent a message, but it seems clear that ActiveDirectoryMembershipProviderthey ActiveDirectoryMembershipUserare not completely cut out for this task, as they exist today.
The answer in this SO question related the following article , which stated the following:
SID , , , .
, , SID Object-SID.
Object-GUID, , . Object-GUID User, Object-SID. - , , , .
, ActiveDirectoryMembershipUser Object-GUID. , SID GUID , ActiveDirectoryMembershipUser , MembershipProvider, , , . , , , , , , ActiveDirectoryMembershipProvider.