Skip to content

Update: Enable QR code generation #37037

@wadepickett

Description

@wadepickett

Description

This article needs a refresh.

It should point to the equivalent Blazor soluctions and a few lines of code should be updated and a general edit provided:

1. Add Blazor cross-reference note (after line 16)

Why: Dedicated Blazor QR code docs now exist and already link back to this article as the "introduction to 2FA with TOTP." This article should reciprocate so Blazor developers don't follow the Razor Pages/MVC instructions unnecessarily.

Insert after line 16 (after the [!WARNING] block, before :::moniker range=">= aspnetcore-8.0"):

> [!NOTE]
> This article covers QR code generation for Razor Pages and MVC apps. For Blazor apps, see <xref:blazor/security/qrcodes-for-authenticator-apps> (Blazor Web App) or <xref:blazor/security/webassembly/standalone-with-identity/qrcodes-for-authenticator-apps> (Blazor WebAssembly with Identity).

2. Modernize partial tag helper syntax (lines 41–43 and 63–64)

Why: @await Html.PartialAsync("_ValidationScriptsPartial") was superseded by the <partial> tag helper starting in ASP.NET Core 2.1. Since this article's monikerRange starts at 2.1, the tag helper is valid for all readers.

Lines 41–43 — change from:

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

To:

@section Scripts {
    <partial name="_ValidationScriptsPartial" />
}

Lines 63–64 — change from:

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

    <script type="text/javascript" src="~/lib/qrcode.js"></script>
    <script type="text/javascript" src="~/js/qr.js"></script>
}

To:

@section Scripts {
    <partial name="_ValidationScriptsPartial" />

    <script type="text/javascript" src="~/lib/qrcode.js"></script>
    <script type="text/javascript" src="~/js/qr.js"></script>
}

3. Fix typo (line 73) "proves" should be "provides."

Change from:

Run your app and ensure that you can scan the QR code and validate the code the authenticator proves.

To:

Run your app and ensure that you can scan the QR code and validate the code the authenticator provides.

Page URL

https://learn.microsoft.com/en-us/aspnet/core/security/authentication/identity-enable-qrcodes?view=aspnetcore-10.0

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/security/authentication/identity-enable-qrcodes.md

Document ID

270bedc7-a636-5bd0-9e2f-e42235deec8c

Platform Id

4dc2d61a-60d3-c5cd-0d33-0d18e6b69dcb

Article author

@wadepickett

Metadata

  • ID: 117c950a-0bcb-d936-31cf-5859b4280abb
  • PlatformId: 4dc2d61a-60d3-c5cd-0d33-0d18e6b69dcb
  • Service: aspnet-core
  • Sub-service: security

Related Issues


Associated WorkItem - 571427

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions