-1

Can I generate asp.net MVC 4 individual login for a database which I already have (tables which use to login are same). Since mvc 4 create their own database for login purpose.

I have created a asp.NET mvc project with single authentication.

When I use that method it will generate database (.mdf) file for it(user registration and login purpose).

What I want is that instead of using auto generated database, I want the application to use my own database with user login auto generated parts.

DhruvJoshi
  • 17,041
  • 6
  • 41
  • 60
Nayanajith
  • 605
  • 10
  • 15
  • 1
    Your question is unclear. Are you suggesting that you have a database which has same schema as the database framework would generate for you, and it has data too? – DhruvJoshi Sep 05 '15 at 13:26
  • sorry for the late reply. the thing is I have created a asp.net mvc Project with single authentication. when I use that method it will generate database (.mdf) file for it(user registration and login purpose). But what I want is instead of using auto generated database I want to use my own database with user login auto generated part – Nayanajith Sep 06 '15 at 12:27
  • As Dhruv said, you need to show the schema of your database. – Win Sep 21 '15 at 16:54

2 Answers2

0

I'd suggest that you change the database name in the connection string in the web.config file.

Typically if you look into the web.config for a line like below

<add name="DefaultConnection" connectionstring="Data Source=.\SQLEXPRESS;
Initial Catalog=aspnet-MvcApplication1-20130603132719;Integrated Security=SSPI"
 providername="System.Data.SqlClient" />

and change it to point to your DB.

DhruvJoshi
  • 17,041
  • 6
  • 41
  • 60
  • Thanks for the reply DhruvJoshi . And you mean I have to have database with same tables used for login purpose ? and can add any other table which I needed. – Nayanajith Sep 20 '15 at 12:12
  • Correct! With EF you can also maintain two separate databases- one for login and one for other other business entity tables. – DhruvJoshi Sep 20 '15 at 14:31
  • Thanks DhruvJoshi , it was a good option indeed. Thanks again. – Nayanajith Sep 21 '15 at 16:19
  • @nayanajith Please do consider upvoting and marking this as answer to the question. This will help future seekers of similar problem to trust the solution and they will benefit from it. – DhruvJoshi Sep 21 '15 at 16:40
0

Yes, you will need to implement you own Membership and Role providers, make some change in Web.config and InitializeSimpleMembershipAttribute.

Take a look at this link for full answer.

Community
  • 1
  • 1
Triet Doan
  • 11,455
  • 8
  • 36
  • 69