3

I try to make a simple web application. There will be very few users(one or two). No need to make complicated membership stuff. I need just basic login process. I use Visual Studio 2013

I made some research on the internet and found something about ASP.NET Identity. However i could not found anything about how to install Identity tables to my own mssql database.

I used ASP.NET membership before and it was easy to install tables by using aspnet_regsql.exe and adding some codes to web.config

But now i am really confused with Identity stuff. It uses a default database to store users. But in my server there will be my sql database that stores both my datas and user datas.

How can i combine these two databases into one? How can I install Identity tables to my own database and configure my Project to use it?

4
  • Do you want to completely configure so you use your own tables? Commented Jan 8, 2015 at 16:20
  • My tables will be seperate from the ones that store users' and login information(Identity tables) Commented Jan 8, 2015 at 16:22
  • 1
    If you need just a basic login process, Identity sounds like a huge overkill... It's usually used when you need membership, different login providers etc. Commented Jan 8, 2015 at 16:23
  • Actually i use WebForms Project just becouse it automatically adds codes and create pages for me. If i had time i would use empity web Project and do my login process on my own. What should i do? Commented Jan 8, 2015 at 16:30

2 Answers 2

1

It sounds like you just want the Identity tables to use the same database as the rest of your application. If you're using a new Identity project in Visual Studio 2013, it should be using Entity Framework, which simplifies things significantly.

You should be able to make this happen by making sure the Identity code uses the same connection string as your own database context. If you change the "DefaultConnection" string in Web.config to point to your own database, Entity Framework will take care of the rest.

If you got rid of the "DefaultConnection" connection, you can change the string used in IdentityModels.cs (in the Models folder of your project) to be your custom string. Look for:

public ApplicationDbContext()
        : base("DefaultConnection", throwIfV1Schema: false)

and change the string in base().

Again, the magic of Entity Framework is that it'll automatically create the tables and relationships it needs without requiring you to build them yourself. EF6 is also really good about handling versioning when there are multiple contexts, so you shouldn't get any "model changed" errors unless you got rid of the __MigrationHistory table.

Sign up to request clarification or add additional context in comments.

Comments

0

You should use Entity Framework you can take different approach like code first ,Model First DB First.

It will make much easier process for you.

Here is some good links.

How to install

http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.