0

I have set up user creation with the UserStore and UserManager classes, this results in the Identity Framework creating the relevant tables for storing users, claims, etc.

However, these tables are being created automatically in a new LocalDB database called "DefaultConnection", but I wish to modify this, because I already have a separate database and I want the Identity framework to use it for creating these tables.

I can't seem to find any configurations in the solution for this new created database and also, I can't seem to find the newly created "DefaultConnection" connection string as it's not in the Web.config file either.

I can successfully login with the created user via the UserManager and GetOwinContext().Authentication.SignIn(), so the Identity framework somehow knows in which database to look for authentication, but yet I don't know where to find these settings.

Is it possible to configure the Identity framework to work with an existing LocalDB database and create the authentication table there in a Web Forms project?

(My project uses Entity Framework v. 6+ model with my existing database)

1 Answer 1

1

You should be able to change the connection string inside of your Identity DbContext.cs file that gets added to your application by default.

look for this code:

public IdentityDbContext()
    : base("Name=SomeDefaultNameConnectionString", throwIfV1Schema: false)
    {
    }

in this code change SomeDefaultNameConnectionString to whatever the name of the connection string is in your WebConfig to the database you want to use.

Also, I highly recommend this Identity video, Adam Tuliper and Jeremy Foster do a GREAT job of explaining everything about Identity, and they also have a more in depth video series on asp Identity as well. Here is the link to the intro video.

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

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.