Getting Started With ASP.NET Core 2.0 Identity And Role Management

In this article, we will see in detail how to use ASP.NET Core Identity in MVC Application for creating user roles and displaying the menu depending on user roles.

C# (2.1 MB)
5 Star
1,350 times
Add to favorites
E-mail Twitter Digg Facebook

Solution explorer

@model EnableAuthenticatorViewModel
    ViewData["Title"] = "Enable authenticator";

    <p>To use an authenticator app go through the following steps:</p>
    <ol class="list">
                Download a two-factor authenticator app like Microsoft Authenticator for
                <a href="">Windows Phone</a>,
                <a href="">Android</a> and
                <a href="">iOS</a> or
                Google Authenticator for
                <a href=";hl=en">Android</a> and
                <a href="">iOS</a>.
            <p>Scan the QR Code or enter this key <kbd>@Model.SharedKey</kbd> into your two factor authenticator app. Spaces and casing do not matter.</p>
            <div class="alert alert-info">To enable QR code generation please read our <a href="">documentation</a>.</div>
            <div id="qrCode"></div>
            <div id="qrCodeData" data-url="@Model.AuthenticatorUri"></div>
                Once you have scanned the QR code or input the key above, your two factor authentication app will provide you
                with a unique code. Enter the code in the confirmation box below.
            <div class="row">
                <div class="col-md-6">
                    <form method="post">
                        <div class="form-group">
                            <label asp-for="Code" class="control-label">Verification Code</label>
                            <input asp-for="Code" class="form-control" autocomplete="off" />
                            <span asp-validation-for="Code" class="text-danger"></span>
                        <button type="submit" class="btn btn-default">Verify</button>
                        <div asp-validation-summary="ModelOnly" class="text-danger"></div>

@section Scripts {
    @await Html.PartialAsync("_ValidationScriptsPartial")