0

I have an MVC 4 application that uses Entity-Framework and SQL Express 2008, and i want to use the same database also for membership and roles. my connection string is:

 <add name="AuthTestDbEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.\sqlexpress;initial catalog=AuthTestDb;user id=sa;password=1234;pooling=False;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

and so i added another connection string for the membership:

<add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=AuthTestDb;user id=sa;password=1234;Integrated Security=True"  providerName="System.Data.SqlClient"/>

and i ran the aspnet_regsql.exe command so it added the necessary tables to my database.

However, if I add a new user using the ASP.NET configuration tool I cannot log in with that user and i can't find him in my database. If i create a new user using the register action i can log in with it but it creates a new database in my App_Data folder called ASPNETDB.MDF.

What do i need to do so that i'll be able to use the same DB for my website?

Yoav
  • 3,326
  • 3
  • 32
  • 73

1 Answers1

0

An Option: Consider looking at a Custom Membership provider and create only the tables/columns you need to support your own application.

I am sure there are a lot of examples if you search for Custom Membership provider, here is one: How do I create a custom membership provider for ASP.NET MVC 2?

Community
  • 1
  • 1
Mark Redman
  • 24,079
  • 20
  • 92
  • 147
  • Thanks for the advice! i actually ended up using [this](http://smehrozalam.wordpress.com/2010/06/29/entity-framework-queries-involving-many-to-many-relationship-tables/) and [this](http://kitsula.com/Article/Custom-Role-Provider-for-MVC). – Yoav Nov 27 '12 at 21:53