LH_
LH_

Reputation: 33

ASP.NET Web App Individual User Accounts Authentication in Visual Studio 2017

When building an ASP.NET MVC Web Application on Visual Studio 2017 I select the option for individual user accounts for built-in register and login functionality. This tells me that it uses a SQL server database for user profiles. After registering a user I am struggling to find this database and the data in visual studio, I cannot find the SQL server database it was referring to when creating the project. Does anyone know where this database is stored as I need to use it for other functionality.

Upvotes: 0

Views: 1533

Answers (2)

MX313
MX313

Reputation: 153

This db is created at runtime... you will not see it after creating your project, you must run it at least once, add a user, and then the Entity framework will create the db structure.

Upvotes: 0

APecha
APecha

Reputation: 128

Take a look at the connection string (look in appsettings.json for a Core app, otherwise web.config)

you might see something like this: "Server=(localdb)\mssqllocaldb;Database=...."

To access this in SQL Server Management Studio, just enter (localdb)\mssqllocaldb as the server name and connect with Windows Authentication, then the Database referenced in the connection string will be accessible.

If you want to access this directly from Visual Studio, select View -> Server Explorer. Once this window is open, Select Connect to a Database. For the Data Source, select Microsoft SQL Server (SqlClient) and for Server Name Enter (localdb)\mssqllocaldb, now the database referenced in your connection string should be able to be selected under the Connect to a Database section.

It's worth noting the database may not be available if you have not run the initial migration.

Upvotes: 2

Related Questions