Skip to content

Update Identity custom user data documentation for .NET 8/9/10 with MVC instructions and troubleshooting#36222

Draft
Copilot wants to merge 8 commits intomainfrom
copilot/customize-identity-user-data
Draft

Update Identity custom user data documentation for .NET 8/9/10 with MVC instructions and troubleshooting#36222
Copilot wants to merge 8 commits intomainfrom
copilot/customize-identity-user-data

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 15, 2025

Overview

This PR updates the Identity custom user data documentation to address user difficulties in customizing ASP.NET Core Identity with simple properties like FirstName and LastName. The documentation was outdated (last updated March 2022) and lacked explicit guidance for .NET 8/9/10 and MVC projects.

Changes Made

1. Added .NET 10 Sample Code

Created a new 10.x/SampleApp sample (the single shared sample for .NET 8, 9, and 10):

  • Updated WebApp1.csproj to target net10.0
  • Updated all Identity and EF Core package references to version 10.0.0
  • Sample demonstrates adding custom Name and DOB properties to IdentityUser

2. Added .NET 10, .NET 9, and .NET 8 Moniker Sections

All new sections include:

Quick Start Checklist: A high-level 6-step guide for the common scenario of adding two custom properties:

  1. Create ASP.NET Core project with Individual Accounts
  2. Scaffold Identity pages
  3. Add custom properties with [PersonalData] attribute
  4. Update Register and Manage pages
  5. Create and apply migration
  6. Test the application

Explicit MVC Instructions: The documentation previously only showed Razor Pages with a note that "instructions are similar for MVC." Now includes:

  • Separate subsections for Razor Pages and MVC project creation
  • Both Visual Studio and .NET CLI commands for each
  • Clear explanation that Identity UI uses Razor Pages even in MVC projects

Troubleshooting Table: Maps common symptoms to likely causes and solutions:

  • Custom fields not appearing in forms
  • Data not persisting to database
  • Fields missing from downloaded personal data
  • Build errors after scaffolding

The .NET 10 moniker is the primary/top section. The .NET 9 and .NET 8 monikers all point to the same 10.x sample folder. Each includes a NOTE explaining that the code is identical between versions and only the target framework and package versions differ in the project file.

3. Updated Existing Sections

  • Changed .NET 6.x moniker range from >= aspnetcore-6.0 to >= aspnetcore-6.0 < aspnetcore-8.0
  • Fixed grammar issues throughout all sections:
    • "want to it match" → "want it to match"
    • "layout file" → "layout file" (removed extra space)
    • "instruction" → "instructions"
    • "examined" → "examine"

4. Fixed Snippet Markers in Sample Files

Changed #region/#endregion markers to // <snippet> / // </snippet> format in the 10.x .cs sample files:

  • Areas/Identity/Pages/Account/Manage/Index.cshtml.cs
  • Areas/Identity/Pages/Account/Register.cshtml.cs

5. Updated Metadata

  • Set ms.date to 04/02/2026
  • Added ai-usage: ai-assisted
  • Reordered metadata alphabetically per Microsoft Learn guidelines

Why These Changes Matter

For .NET 8/9/10 Users: The documentation now explicitly covers current LTS and STS versions, including .NET 10, with up-to-date sample code.

For MVC Developers: No more confusion about whether the guidance applies—explicit instructions are provided, along with clarification that Identity UI is implemented as Razor Pages regardless of project type.

For Beginners: The Quick Start checklist provides a mental model before diving into details, and the troubleshooting table helps diagnose common mistakes.

Validation

  • All code snippet references in the .NET 8, 9, and 10 moniker sections point to valid files in the 10.x sample
  • Snippet markers use // <snippet> / // </snippet> format in all sample .cs files
  • Moniker ranges validated (no overlaps, covers all versions: 10.0, 9.0–10.0, 8.0–9.0, 6.0–8.0, 3.0–6.0, <3.0)
  • Pre-existing 2.x, 3.x, and 6.x sample folders are unchanged
  • Metadata follows Microsoft Learn standards
  • Grammar improvements enhance professional quality

The GitHub workflow will validate the documentation build when this PR is reviewed.

Original prompt

This section details on the original issue you should resolve

<issue_title>MVC Customize Identity Issue</issue_title>
<issue_description>### Description

Hi, I have been struggling with adding FirstName LastName custom data into an identityUser customization. Not looking for a detailed, response, but hi level. If I create a new project (MVC Framework 8, authentication type individuals) and started from there, should this work?
Do you have a tutorial that starts from there? Would be nice if not. been trying to do this for min 2-3 years, and I keep giving up because I never can get it to work.

Page URL

https://learn.microsoft.com/en-us/aspnet/core/security/authentication/add-user-data?view=aspnetcore-9.0&tabs=visual-studio

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/security/authentication/add-user-data.md

Document ID

cd157d04-d596-83fa-6edb-24d52193eb34

Platform Id

6617dcc3-4828-8b6c-4b70-b2be2a7b9233

Article author

@wadepickett

Metadata

  • ID: 431df4fc-4168-cc8f-d053-9b264d2971c1
  • PlatformId: 6617dcc3-4828-8b6c-4b70-b2be2a7b9233
  • Service: aspnet-core
  • Sub-service: security

Related Issues</issue_description>

Comments on the Issue (you are @copilot in this section)

@wadepickett @krm240, you are right, this topic needs some help. Sorry to hear about the awful experience. I didn't author the original article, but I'm checking through to see how we can improve it. Thanks very much for taking the time to let us know. @wadepickett # Issue Analysis: Identity Custom User Data Guidance Outdated

Issue Summary

This is a valid issue.

Developers often need to just add simple custom properties (FirstName, LastName) to an ASP.NET Core Identity user in a newly created MVC (.NET 8 / 9, Individual Accounts) project. The current article’s sample and narrative focus on a Razor Pages template (6.x-era) and only mentions that instructions are “similar” for MVC, without explicitly showing the modern MVC & Razor Pages templates, current dotnet new commands, or a concise high-level checklist. The article is dated (ms.date 03/15/2022), has no moniker section for .NET 7/8/9, and therefore appears stale. This creates friction for developers expecting direct, up-to-date guidance.

Decision: Introduce a new .NET 9 (current) sample (add-user-data/samples/9.x/SampleApp) and reuse it for .NET 8 by noting that the code is identical except for TargetFramework. This avoids creating a separate 8.x sample folder and keeps future maintenance minimal.

Scope Validation

Within article intent: Yes. The doc’s purpose is to show how to add, download, and delete custom user data with Identity. Adding explicit guidance for MVC, current versions, and a minimal property scenario (First/Last name) fits squarely within scope.

Target Framework / Tooling (Current vs. Document)

Document currently: monikers up to >=6.0 (lines 25–170 in existing version), plus older 3.x and 2.x sections.
Needed: Add >= aspnetcore-9.0 (primary), add >= aspnetcore-8.0 < aspnetcore-9.0 referencing the 9.x sample, retain/adjust >=6.0 <8.0 as legacy. Update ms.date.

Root Causes of User Difficulty

  1. No explicit .NET 8/9 mention; perceived obsolescence.
  2. Lack of explicit MVC template steps (dotnet new mvc -au Individual).
  3. No quick-start “just add 2 properties” checklist.
  4. Identity Razor Pages architecture not clearly reiterated for MVC projects.
  5. Minor grammar issues reduce confidence (e.g., “want to it match”, “layout file”, past tense in bullet lists).
  6. No updated sample demonstrating current LTS/STS.

Resolution Strategy

Create a single new .NET 9 sample and reuse its code for .NET 8:

  • Folder: aspnetcore/security/authentication/add-user-data/samples/9.x/SampleApp
  • TargetFramework: net9.0
  • Snippets referenced by both .NET 9 and .NET 8 monikers; .NET 8 moniker adds a note that code is identical.

Rationale:

  • Identity customization steps unchanged between 8 and 9.
  • Minimizes duplication and maintenance.
  • Improves credibility by presenting a “current” sample.

Documentation Changes (High-Level)

  1. Metadata

    • Update ms.date to a current date (e.g., 10/15/2025).
  2. Moniker Restructure

    • Add :::moniker range=">= aspnetcore-9.0" (primary instructions, points to 9.x sample).
    • Add :::moniker range=">= aspnetcore-8.0 < aspnetcore-9.0" referencing 9.x sample, noting identical code.
    • Adjust existing >= aspnetcore-6.0 to >= aspnetcore-6.0 < aspnetcore-8.0 for legacy.
    • Leave 3.x and <3.0 as-is (with grammar fixes).
  3. New Sections / Enhancements

    • “Quick checklist” for adding two properties (FirstName, LastName).
    • Explicit project creation instructions for both Razor Pages ...

Fixes #36213


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


Internal previews

📄 File 🔗 Preview link
aspnetcore/security/authentication/add-user-data.md aspnetcore/security/authentication/add-user-data
aspnetcore/security/authentication/add-user-data/samples/10.x/SampleApp/wwwroot/lib/jquery-validation/LICENSE.md aspnetcore/security/authentication/add-user-data/samples/10.x/SampleApp/wwwroot/lib/jquery-validation/LICENSE

Copilot AI and others added 2 commits October 15, 2025 16:01
Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com>
…checklist, troubleshooting, and fix grammar issues

Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com>
Copilot AI changed the title [WIP] Add FirstName LastName custom data to identityUser Update Identity custom user data documentation for .NET 8/9 with MVC instructions and troubleshooting Oct 15, 2025
Copilot AI requested a review from wadepickett October 15, 2025 16:13
Corrected copilot text.
@wadepickett
Copy link
Copy Markdown
Contributor

wadepickett commented Oct 15, 2025

Notes: Wade's AI issue handling tests:

For this issue + PR:

  • AI generated pre-run analysis run to prep Copilot to be more successful with what would be a complicated PR since doc and sample versioning, data migration scenario, two app architectures (Razor Pages + MVC) multiple IDE's were involved along with full app samples. (GitHub Copilot + GPT-5 +repo level instruction files)

  • AI for PR Generation, by simply assigning Copilot to the issue. (GitHub Copilot + default model + Repo level AI instruction)

Verified the app generated also followed our rules for not using minified versions of assets as instructed (bootstrap, jquery) since our .gitignore file excludes them. This AI gen PR followed the new instructions on that perfectly here.

  • Human modification:
    The AI gen pre-analysis wanted to generate complete samples for every version. While this technically was an OK solution, there were no changes in code required between several .NET versions related to the needed sample, so I corrected the AI gen pre-analysis to just do one full app sample (~560 files) as opposed (150+ files)

  • Automated build was run successfully without warnings.

Corrections to AI draft:
The app sample is not using the compressed version of bootstrap

Next:

  • Needs human test through in review phase for doc plus samples.

@wadepickett
Copy link
Copy Markdown
Contributor

wadepickett commented Oct 15, 2025

Reminder for myself: @krm240 who created the issue, was kind to offer to test through the new steps on the resulting topic update for useability. Loop in krm240 when this is ready to be reviewed.

@krm240
Copy link
Copy Markdown

krm240 commented Oct 15, 2025 via email

@wadepickett
Copy link
Copy Markdown
Contributor

@copilot, the instructions for Visual Studio do not match the steps required in the latest UI of Visual Studio Professional Insiders Edition 2026. Update to match. If unsure of how to do this, say so.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 16, 2025

@copilot, the instructions for Visual Studio do not match the steps required in the latest UI of Visual Studio Professional Insiders Edition 2026. Update to match. If unsure of how to do this, say s...

I need clarification on the specific Visual Studio 2026 UI changes. Could you provide details on:

  1. Which specific instructions don't match (project creation, scaffolding, or both)?
  2. What are the actual steps in VS 2026 Professional Insiders Edition?

For example:

  • Has the menu structure changed (File > New > Project)?
  • Are the template names different?
  • Has the authentication configuration dialog changed?
  • Are there new or different options in the scaffolder?

Without access to VS 2026 Professional Insiders Edition or specific details about the UI changes, I cannot accurately update the instructions. Please provide the correct steps or screenshots of the new UI flow.

@wadepickett
Copy link
Copy Markdown
Contributor

wadepickett commented Oct 16, 2025

Notes: Wade’s AI Issue-Handling Tests
Copilot Instruction Improvement Opportunity

Problem:
Copilot attempted step by step instructions for a new project set up and Identity scaffolding using the latest Visual Studio version. Even though Copilot wasn’t expected to be aware of recent changes, it made an attempt without flagging low confidence. When asked directly, it correctly indicated low confidence, confirming that it simply wasn’t up to date (as expected).

Improvement opportunity:
Enhance Copilot’s instructions so that it proactively flags low-confidence areas, giving reviewers or collaborators a clear heads-up, especially when handling new or recently updated IDE workflows

In this case for this PR, the Visual Studio instruction will need to be entered correctly in a commit by a human author. The CLI instruction looks good however.

@wadepickett
Copy link
Copy Markdown
Contributor

@copilot,
The #region/#endregion snippet markers in the .cs files must be changed to // / // format. Fix this.

… sample files

Agent-Logs-Url: https://github.com/dotnet/AspNetCore.Docs/sessions/a5212baf-7008-4422-b808-7856eeab4130

Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 2, 2026

@copilot,
The #region/#endregion snippet markers in the .cs files must be changed to // / // format. Fix this.

Fixed in commit e7d6b3e. Both files now use // <snippet> / // </snippet> format instead of #region/#endregion:

  • Areas/Identity/Pages/Account/Manage/Index.cshtml.cs
  • Areas/Identity/Pages/Account/Register.cshtml.cs

@wadepickett
Copy link
Copy Markdown
Contributor

@copilot, This PR sample and content update needs to alsl address .NET 10. Add a >= aspnetcore-10.0 moniker section as the primary/top section targeting .NET 10, with a new 10.x sample.

…unded range

Agent-Logs-Url: https://github.com/dotnet/AspNetCore.Docs/sessions/0daffe27-8a7d-4332-a961-5b2e2f748fd1

Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 2, 2026

@copilot, This PR sample and content update needs to alsl address .NET 10. Add a >= aspnetcore-10.0 moniker section as the primary/top section targeting .NET 10, with a new 10.x sample.

Done in commit 89dd773. Added:

  • New 10.x/SampleApp copied from 9.x, targeting net10.0 with 10.0.0 package versions
  • New >= aspnetcore-10.0 moniker section as the primary/top section, referencing the 10.x sample
  • Updated the existing >= aspnetcore-9.0 range to >= aspnetcore-9.0 < aspnetcore-10.0
  • Updated ms.date to 04/02/2026

Copilot AI changed the title Update Identity custom user data documentation for .NET 8/9 with MVC instructions and troubleshooting Update Identity custom user data documentation for .NET 8/9/10 with MVC instructions and troubleshooting Apr 2, 2026
Removed outdated author attribution from the article.  The article has been rewritten many times since.
@wadepickett
Copy link
Copy Markdown
Contributor

@copilot The 9.x and 10.x sample apps introduced in this PR are byte-for-byte identical in all code files, only the .csproj target framework and package versions differ. To reduce duplication and maintenance burden, we want to eliminate the 9.x sample folder added in this PR and have the .NET 8, 9, and 10 moniker sections all point to the 10.x sample instead. The pre-existing 2.x, 3.x, and 6.x sample folders and their moniker sections should not be changed. Please make the following changes:

Delete the entire aspnetcore/security/authentication/add-user-data/samples/9.x/ folder and all its contents.

In the .NET 9 moniker section (>= aspnetcore-9.0 < aspnetcore-10.0) of aspnetcore/security/authentication/add-user-data.md, update all [!code-*] references from samples/9.x/ to samples/10.x/. Also update the Program.cs GitHub link from 9.x to 10.x. Add a NOTE block (same style as the one already in the .NET 8 section) at the top of the moniker section, right after the SDK include, explaining that the code samples reference the 10.x sample folder because the code is identical between .NET 9 and .NET 10, only the target framework and package versions differ in the project file.

In the .NET 8 moniker section (>= aspnetcore-8.0 < aspnetcore-9.0), update all [!code-*] references from samples/9.x/ to samples/10.x/. Also update the Program.cs GitHub link from 9.x to 10.x. Update the existing NOTE block to say the samples reference the 10.x sample folder instead of 9.x, and that the code is identical between .NET 8 and .NET 10.

…0.x sample

Agent-Logs-Url: https://github.com/dotnet/AspNetCore.Docs/sessions/81345aba-c8b5-4f90-92ef-64a1aec3019f

Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 2, 2026

@copilot The 9.x and 10.x sample apps introduced in this PR are byte-for-byte identical in all code files, only the .csproj target framework and package versions differ. To reduce duplication and mai...

Done in commit c61fd35:

  • Deleted the entire samples/9.x/ folder
  • Updated all [!code-*] references and Program.cs GitHub links in the .NET 9 moniker section from 9.x to 10.x
  • Added NOTE in the .NET 9 moniker section: "The code samples and instructions for .NET 9 reference the 10.x sample folder. The code is identical between .NET 9 and .NET 10 for this scenario. Only the target framework and package versions differ in the project file."
  • Updated all [!code-*] references and Program.cs GitHub links in the .NET 8 moniker section from 9.x to 10.x
  • Updated the .NET 8 NOTE to: "The code samples and instructions for .NET 8 reference the 10.x sample folder. The code is identical between .NET 8 and .NET 10 for this scenario. Only the target framework and package versions differ in the project file."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MVC Customize Identity Issue

3 participants