ASP.NET Core: Razor Pages

Authentication Registration Page

Our authentication set up needs three pages, a register page, a signin page and a signout page.

Set Up the Model

Registration will be build around the following model. Add the model to your Models/ folder.

Models/Register.cs

No need to run a migration via Update Database as the table for this data was created in the last step.

In the pages/Secure folder, create a page called Register.cshtml. Do so via:

This will create a .cshtml page and an associated .cshtml.cs page model file.

Edit the Page Model:

PAGE MODEL: Pages/Secure/Register.cshtml.cs

Notice that a role of manager is hard coded into this example.

Next edit the Page Pages/Secure/Register.cshtml

PAGE: ages/Secure/Register.cshtml

Note - this is controlled by a Cookie I think called .AspNetCore.Identity.Application. The Cookie controlling the Identity framework can be renamed in Startup.cs in the options for the ConfigureApplicationCookie using an option value of Cookie.Name