Reputation: 53
I have just started learning ASP.NET MVC(4). For practice purpose I am starting with a micro blogging project. So it will obviously have user database. When I create ASP.Net MVC4 project, it comes with Membership module that already exists (AccountsController.cs, AccountModel.cs and view files).
I don't have database right now so I will be using EF with design / model first approach. I tried creating a sample application with database. When I registered a user (with registration page provided by Asp.Net MVC4) I couldn't see any user table in my database. I want to know where are the tables having information about user, userrole. I don't find it in my database.
One more thing, should I use MVC4 Authentication or create a new table for Users?
Help me with this please..
Regards, Rahul
Upvotes: 4
Views: 3327
Reputation: 6962
The default ASP.NET MVC 4 "Internet Application" project template comes with some default membership capabilities. If you search for and update the line below, the Membership tables will be created in your database if they do not already exist:
WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true);
more info here:
http://aaron-hoffman.blogspot.com/2013/02/aspnet-mvc-4-membership-users-passwords.html
Upvotes: 2
Reputation: 93464
MVC 4 by default uses SimpleMembership, which uses the default LocalSqlServer connection string specificed in your computers machine.config. This creates the data in a database located in the App_Data directory of your project.
Upvotes: 2