Search code examples
asp.net-mvc-4asp.net-membershipsimplemembership

SimpleMembership with ASP.Net MVC 4 project


I created a MVC 4 project using MS Visual Web Developer 2010 Express. It by default uses "SimpleMembership" and it connects to a database (A) on my local SQL Server. I ran the web project and registered a trial user, and it was successful. When I checked the database A with Management Studio, the user was there.

However, when I turned on debug and opened the ASP.NET Web Application Administration Web Tool. It showed User: 0. Obviously the Admin Tool did not check the database A. Then I was able to create another user via the Admin Tool. Surprisingly it was found added to the "aspnetdb.mdf" in "App_Data" folder of my project.

My questions are:

  1. how I can make the Admin Tool connect to the database A on my SQL Server instead of the "aspnetdb.mdf" file as I don't want to store my user profiles in two separate places.

  2. Why "aspnetdb.mdf" uses ASP.Net Membership instead of "SimpleMembership"?

Thanks!


Solution

  • The Web Application Administration Tool was developed for SimpleMembership's predecessor ASP.NET Membership. When Microsoft released SimpleMembership they never bothered to provide support for any admin tool; you have to create one yourself. Take a look at this QA which explains in more detail.

    Be aware that Microsoft has dropped SimpleMembership in MVC 5 for ASP.NET Identity. ASP.NET Identity is a much better solution, but it still does not come with an admin tool. I would move to ASP.NET Identity if possible. Here is an article on how to migrate to ASP.NET Identity.