[release/11.0-preview4] Update Blazor templates to use TempData#66456
Merged
wtgodbe merged 1 commit intodotnet:release/11.0-preview4from Apr 24, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Backports the Blazor Identity template change to pass status messages between pages via TempData ([SupplyParameterFromTempData]) instead of the custom short-lived cookie approach.
Changes:
- Simplifies
StatusMessageinto a purely presentational component that only renders an explicitly provided message. - Removes cookie-based status message plumbing from
IdentityRedirectManagerand updates account/manage pages to read/write status via TempData. - Updates invalid-user handling to generate its own message on the
InvalidUserpage rather than via redirect helper methods.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Shared/StatusMessage.razor | Removes cookie-reading logic; renders only the passed-in message. |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/Manage/TwoFactorAuthentication.razor | Reads/writes status messages via TempData and passes message to StatusMessage. |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/Manage/SetPassword.razor | Uses TempData for post-redirect status messaging. |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/Manage/ResetAuthenticator.razor | Uses TempData for post-redirect status messaging and passes message to StatusMessage. |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/Manage/RenamePasskey.razor | Writes TempData status messages before redirecting back to Passkeys. |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/Manage/PersonalData.razor | Reads TempData message and passes it to StatusMessage. |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/Manage/Passkeys.razor | Converts multiple redirect-with-status flows to TempData + redirect. |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/Manage/Index.razor | Uses TempData for post-redirect status messaging and passes message to StatusMessage. |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/Manage/GenerateRecoveryCodes.razor | Reads TempData message during initialization. |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/Manage/ExternalLogins.razor | Uses TempData for post-redirect status messaging and passes message to StatusMessage. |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/Manage/EnableAuthenticator.razor | Uses TempData for post-redirect status messaging. |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/Manage/Email.razor | Reads TempData message during initialization. |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/Manage/Disable2fa.razor | Uses TempData to pass status message when redirecting to 2FA page. |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/Manage/DeletePersonalData.razor | Reads TempData message during initialization. |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/Manage/ChangePassword.razor | Uses TempData for post-redirect status messaging. |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/Login.razor | Reads TempData status message into the login page’s message display. |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/InvalidUser.razor | Generates the invalid-user error message locally and passes it to StatusMessage. |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/ExternalLogin.razor | Uses TempData for redirect status messages; includes minor markup whitespace fix. |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/ConfirmEmailChange.razor | Uses TempData for redirect status messages and fixes the user-not-found message. |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/IdentityRedirectManager.cs | Removes cookie-based status helpers; introduces StatusMessageKey constant for TempData usage. |
ilonatommy
approved these changes
Apr 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #65752 to release/11.0-preview4
Update Blazor templates to use TempData
Description
Updates the Blazor Identity project template to pass status messages between pages using
[SupplyParameterFromTempData]instead of cookies. This replaces the custom cookie-based approach (Identity.StatusMessagecookie with a 5-secondMaxAge) with the built-in TempData mechanism, which is simpler and follows standard ASP.NET Core patterns.Changes
IdentityRedirectManager.csStatusCookieNameconstant,StatusCookieBuilder, and all cookie-writing logicStatusMessageKeyconstant ("Identity.StatusMessage") for the TempData entry keyRedirectToWithStatus,RedirectToCurrentPageWithStatus, andRedirectToInvalidUsermethods entirely — status message passing is now handled by the pages themselves via[SupplyParameterFromTempData]usingdirectives (Microsoft.AspNetCore.Identity,BlazorWebCSharp._1.Data)StatusMessage.razor[Parameter] string? MessageHttpContextcascading parameter, cookie reading logic,messageFromCookiefield, andDisplayMessagecomputed propertyInvalidUser.razorUserManager.GetUserId(HttpContext.User)instead of receiving it through a redirect fromIdentityRedirectManagerAccount pages (16
.razorfiles)[SupplyParameterFromTempData(Name = IdentityRedirectManager.StatusMessageKey)]property to each page for reading and writing status messages via TempDataIdentityStatusMessageduring initialization and stores it in a localmessagefield, then nulls it out (TempData is one-time-read)RedirectManager.RedirectToWithStatus(url, message, HttpContext)calls with settingIdentityStatusMessage = messagefollowed byRedirectManager.RedirectTo(url)RedirectManager.RedirectToInvalidUser(UserManager, HttpContext)calls withRedirectManager.RedirectTo("Account/InvalidUser")<StatusMessage />now pass the message explicitly:<StatusMessage Message="@message" />Minor fix
ExternalLogin.razor(<div class=→<div class=)ConfirmEmailChange.razorwhere the error message string was not interpolated ('{userId}'→'{UserId}')Customer Impact
Templates update to simplify them and show best practices.
Regression?
[If yes, specify the version the behavior has regressed from]
Risk
[Justify the selection above]
Verification
Packaging changes reviewed?
When servicing release/2.3