This tutorial will show you how to create the default users database packaged with Visual Studio and which caters for user authentication. If you prefer to start with a completely blank database then follow the previous tutorial instead.
We will start by setting up your work space which may well look like this if you have opened Visual Studio 2017 for the first time.
We want to have access to the Server Explorer pane (not to be confused with the Solution Explorer). If its not readily accessible, you can go to 'View' on the menu bar and select 'Server Explorer' (quick keys, 'Ctrl + W', release and press 'L').
The typical / default location of the Server Explorer is on the left with the Toolbox.
We will cover 'Create a New Web Project' again later, but to create a database based on the ASP template we need to create one now. You should use this as the basis of your web project.
Under the 'New Project' heading, select to 'Create new project...'
Note: This is similar in different versions of Visual Studio but the placement on this 'Start Page' varies a little.
Our chosen language is C# ('Visual C#') and we will be using a typical ASP.NET Web Application template (shown below).
Underneath, name your project (e.g. 'AssetManagementSystem' and select a save location.
We will be using 'Web Forms' for this tutorial, but many .NET web developers now favour MVC (Model-View-Controller) architecture as a more modern and efficient approach.
Select to 'Change Authentication' before we select 'OK'.
A few options available here, pick whichever is suitable and click 'OK':
No Authentication: For applications that don't need a login feature or if you wish to create your own database system for this.
*(Preferred Option)* Individual User Accounts: Typical login system for a SQL Server database (with options to allow login with popular social media accounts).
Work or School Accounts / Organization Accounts: when users login using their Active Directory or 365 accounts.
Windows Authentication: Explained as 'For intranet applications', which I assume means if your client machine will access the database on the same machine or on a local network.
In Visual Studio 2017 we are brought to a new overview screen, but whichever version you are using its important to know that your database will only be created after you establish your first user.
Select to 'Start' (represented with a green 'play' style arrow) the project in your preferred browser. We are using Microsoft Edge (circled below):
Your template website should run and look similar to the image below with a 'jumbotron' banner under a main menu and three sections before a simple footer with copyright text.
Select to 'Register' using the button on the top right.
Enter some suitable credentials for your administrator and first user. Click 'Register' on the form.
You will be brought back to the home page with a 'Hello, <username>' and 'Log off' in place of the previous 'Register' and 'Log in'
Back in Visual Studio, you will see a pause and stop style buttons where play was previously. While the code is running we cannot edit anything, so click the 'Stop' button (circled below).
You should now be able to see your database under 'Data Connections' in the 'Server Explorer'. Its name will be 'DefaultConnection (<database-name>)'.
You can expand it open to see a number of folders, and then expand 'Tables' to view the structure of the default database. Each table can also be expanded to see the fields inside it.
Well done, we have a new users database. Do you need to create your own tables to store specific data for your needs? If so, continue to the next tutorial.