I have a question about using form authentication in ASP.net MVC.
I ran aspnet_regsql against the SQL 2008 server database that my MVC 3 application is using. This created a new database in my server. I can now login and secure my controllers.
My question is this: Should I change the database where my application stores its data? Or am I supposed to use two databases, one for security and another for my application?
Thank you for any advice.
You can do it either way. You can combine the security and application data into a single database, or you can keep them as two separate databases. Which you choose depends upon personal preference and the complexity of your application database. You may wish to keep them separate so that the tables are separated by their function into separate databases. On the other hand, this will make your database maintenance a bit more complicated, since now you will have to back up two databases and, in the case of a disaster, restore two databases instead of only one.
Edit:
As you pointed out in your comment, if you split these into two databases and you want to have a foreign key reference from your application database to your authentication database, this can be a problem. Sql Server does not support cross-database foreign key references. If this is a deal-breaker for you, you can either 1) combine both databases into a single database, or 2) look into some of the work-arounds to circumvent this lack of support for cross-database foreign key references. If you choose to go this second route, there is a good stackoverflow post on this issue that you might want to start with.