We are developing an ASP.NET MVC Application that currently uses it's own database ApplicationData
for the domain models and another one Membership
for the user management / membership provider.
We do access restrictions using data-annotations
in our controllers.
[Authorize(Roles = "administrators, managers")]
This worked great for simple use cases.
As we are scaling our application our customer wants to restrict specific users
to access specific areas of our ApplicationData
database.
Each of our products contains a foreign key referring to the region the product was assembled in.
A user story would be:
We created a placeholder table UserRightsRegions
that contains the UserId
and the RegionId
.
How can I link both the ApplicationData
and the Membership
databases in order to work properly / having cross-database-key-references
? (Is something like this even possible?)
All help is more than appreciated!
The ASP.NET membership provider is a feature that enables ASP.NET developers to create Web sites that allow users to create unique user name and password combinations. With this facility, any user can establish an account with the site, and sign in for exclusive access to the site and its services.
To create a user in our application by using ASP.NET Membership we need the following steps to complete this process. Step 1: Firstly, open visual studio, then go to File Menu and click New -> Web Site. Step 2: After open the new empty website and add a new item Login. aspx in Registration inside Solution Explorer.
SQLMembershipProvider : It is used to store user information in a SQL Server database. ActiveDirectoryMembershipProvider : It is used to store user information in an Active Directory.
In my opinion, you should be able to integrate your database with the standard aspnet_db reliably, but I would advise against duplicating or replacing the aspnet_users table.
That is the focal point of all the providers that use the aspnet_db schema, including custom providers that may augment but do not implement custom replacement.
To maximize reuse of strong tested infrastructure code in the provider stack/API it is best to go with that flow.
You will want to be very attentive to any modified membership core functions and ensure that the way your new constraints behave in an expected fashion in each case.
The facet of the membership story that I have found needs the most attention is deleting a user, and a simple modification/addition to the delete user sproc can manage this capably.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With