Skip to content

Commit 30461a1

Browse files
authored
Merge pull request #35864 from dotnet/main
2 parents 7c5d404 + 34f66f1 commit 30461a1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+237
-54
lines changed

.github/copilot-instructions.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
---
2+
author: wadepickett
3+
ms.author: wpickett
4+
ms.date: 07-31-2025
5+
---
6+
7+
# Copilot Instructions for `dotnet/AspNetCore.Docs`
8+
9+
## Introduction
10+
This document contains general and repository-specific instructions for GitHub Copilot when assisting with the `dotnet/AspNetCore.Docs` repository. **Unless otherwise specified, all ".NET" references refer to modern .NET, not .NET Framework.**
11+
12+
## General Guidelines
13+
14+
### Issue Handling
15+
When creating a PR for an issue:
16+
1. Read the full issue and all linked references
17+
2. Study code samples from linked PRs that demonstrate features in the latest .NET pre-release version (e.g., .NET 10 Preview) to ensure that guidance and documentation reflect the latest upcoming changes and best practices.
18+
3. For labeled issues that have the following labels, follow these guidelines:
19+
- **new-feature:** State which version introduced the feature
20+
- **bug:** Focus on correcting technical inaccuracies
21+
4. When you're assigned an issue, after you've completed your work and the workflows (status checks) have run, ensure there are no build warnings under the OpenPublishing.Build status check. If there are, open the build report (under View Details) and resolve any build warnings you introduced.
22+
5. Provide an overview of the project you're working on, including its purpose, goals, and any relevant background information.
23+
6. Include the folder structure of the repository, including any important directories or files that are relevant to the project.
24+
25+
### Markdown File Naming and Organization
26+
- If you're adding a new Markdown file, it should be named in all lowercase with hyphens separating words. Also, omit any filler words such as "the" or "a" from the file name.
27+
28+
### API References and Verification
29+
- Use `<xref:api-doc-ID>` for API cross-references.
30+
- The API documentation ID must be verified and sourced from the official XML documentation in dotnet-api-docs, never just infer API documentation IDs by looking for similar patterns.
31+
- If you cannot verify, state that explicitly in your output.
32+
33+
### Links and References
34+
- Use relative links (for example, `../folder/file.md` or `./file.md`) when referencing files within this repository. Do not use absolute URLs or GitHub web links for internal content.
35+
- For external links, always remove any language or culture segment from the URL path (such as `/en-us/`, `/fr-fr/`, `/en/`, etc.).
36+
- Example (Microsoft Learn):
37+
- Original: `https://learn.microsoft.com/en-us/aspnet/core/blazor/`
38+
- Correct: `https://learn.microsoft.com/aspnet/core/blazor/`
39+
- Example (Wikipedia):
40+
- Original: `https://en.wikipedia.org/wiki/ASP.NET_Core`
41+
- Correct: `https://wikipedia.org/wiki/ASP.NET_Core`
42+
- For Microsoft Learn links, also strip the base domain (`https://learn.microsoft.com/en-us`) so only the path remains.
43+
- Example:
44+
- Original: `https://learn.microsoft.com/en-us/aspnet/core/blazor/`
45+
- Correct: `/aspnet/core/blazor/`
46+
47+
## Repository-Specific Guidelines
48+
- Follow the [Microsoft Writing Style Guide](https://learn.microsoft.com/en-us/style-guide/welcome/)
49+
- **Repository Exceptions**:
50+
- Number ordered lists as "1." for every item (don't use sequential numbers)
51+
- Use backticks around content specifically for file names (`file.txt`), folders (`folder`), file paths (`folder/file.txt`), custom types (`myVariable`, `MyClass`), raw URLs in the text (`https://www.contoso.com`), URL segments (`/product/id/199`), file extensions (`.razor`), NuGet packages (`Microsoft.AspNetCore.SignalR.Client`), and code that should never be localized
52+
- For Blazor's Razor components mentioned in article text, use backticks around the name of the component (example: `Counter` component)
53+
- For any new or updated .md file, ensure the standard frontmatter (metadata) is included as specified in [Metadata for Microsoft Learn documentation.](https://learn.microsoft.com/en-us/contribute/content/metadata)
54+
- For any new or updated .md file added to the repository, ensure the following frontmatter (metadata) is included:
55+
- Metadata `ai-usage: ai-assisted` if any AI assistance was used
56+
- Place the title metadata first, followed by the remaining metadata lines in alphabetical order. Example: `title`, `author`, `description`, `monikerRange`, `ms.author`, `ms.custom`, `ms.date`, `uid`, `zone_pivot_groups`
57+
- Metadata `ms.date: <today's date>` with a format of MM-DD-YYYY. If the file already has a `ms.date` metadata, update it to today's date if more than 50 characters are changed in the file.
58+
59+
### Version Targeting Common Range Patterns
60+
- Fixed Range: `>= aspnetcore-7.0 <= aspnetcore-9.0`
61+
- Open Upper Bound: `>= aspnetcore-7.0`
62+
- Open Lower Bound: `<= aspnetcore-9.0`
63+
- Specific Version: `== aspnetcore-9.0`
64+
65+
### Code Snippets
66+
- For code snippets longer than 6 lines:
67+
1. Create a subfolder named after the document the snippet supports.
68+
1. Create a `snippets` folder inside that subfolder.
69+
1. For the code file:
70+
- If the snippet is not version-specific, place the code in a file with the appropriate extension (for example, `.cs` for C#) in the `snippets` folder.
71+
- If the snippet is version-specific:
72+
1. Create a subfolder inside the `snippets` folder named for the version (for example, `9.0` for .NET 9 or ASP.NET Core 9).
73+
1. Place the code in a file with the correct extension inside the version subfolder.
74+
1. Add a project file (`.csproj`) to the version subfolder targeting the matching .NET version, if necessary to run or build the snippet.
75+
- Reference snippets using triple-colon syntax:
76+
- **Use file-relative paths** for snippets located in the same file as the articles that refer to it.
77+
```
78+
:::code language="csharp" source="../snippets/my-doc/Program.cs":::
79+
```
80+
- **Use repository root-relative paths** for shared snippets:
81+
```
82+
:::code language="csharp" source="~/tutorials/min-web-api/samples/9.x/todoGroup/TodoDb.cs":::
83+
```
84+
- For longer snippets, highlight specific lines:
85+
```
86+
:::code language="csharp" source="~/path/to/file.cs" range="5-10" highlight="2-3":::
87+
```
88+
- Use the latest, non-preview C# coding patterns in non-preview code examples
89+
- Use the latest preview C# coding patterns in preview code examples
90+
- Use the following language code and indentation standards for markdown code blocks or the `language` attribute of code snippets:
91+
92+
Content of the snippet | Language code | Indentation in spaces
93+
:---: | :---: | :---:
94+
C# | csharp | 4
95+
HTML | html | 4
96+
CSS | css | 4
97+
JavaScript | javascript | 2 spaces (use 4 spaces for line continuation)
98+
XML | xml | 2
99+
JSON | json | 2
100+
Console | console | 2
101+
Text | - | 2
102+
103+
### ASP.NET Core Specific Guidelines
104+
- Use the latest supported version for examples unless otherwise specified
105+
- Title and section header casing is sentence case (capitalize the first word and any proper nouns)
106+
- For parts of a title or section header that normally use code style in article text (backticks around the content), also use code style in the title or section header (example H1 header: "# Modify the `Program.cs` file")
107+
- Use code style for any words that shouldn't be localized
108+
- For bullet lists, use an asterisk as the bullet marker
109+
- Bullet lists should have two or more entries at the same level in the list. If there is only one item under a bullet, remove its bullet marker and roll that item into its parent bullet.
110+
- Lead with Microsoft-recommended approaches
111+
- Include differences between Minimal API and controller-based approaches when relevant
112+
- For middleware content and examples, use the middleware class approach

aspnetcore/blazor/components/data-binding.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: guardrex
44
description: Learn about data binding features for Razor components and DOM elements in Blazor apps.
55
monikerRange: '>= aspnetcore-3.1'
66
ms.author: wpickett
7-
ms.custom: mvc
7+
ms.custom: mvc, sfi-ropc-nochange
88
ms.date: 11/12/2024
99
uid: blazor/components/data-binding
1010
---

aspnetcore/blazor/javascript-interoperability/call-dotnet-from-javascript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: guardrex
44
description: Learn how to invoke .NET methods from JavaScript functions in Blazor apps.
55
monikerRange: '>= aspnetcore-3.1'
66
ms.author: wpickett
7-
ms.custom: mvc
7+
ms.custom: mvc, sfi-ropc-nochange
88
ms.date: 12/17/2024
99
uid: blazor/js-interop/call-dotnet-from-javascript
1010
---

aspnetcore/blazor/javascript-interoperability/call-javascript-from-dotnet.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: guardrex
44
description: Learn how to invoke JavaScript functions from .NET methods in Blazor apps.
55
monikerRange: '>= aspnetcore-3.1'
66
ms.author: wpickett
7-
ms.custom: mvc
7+
ms.custom: mvc, sfi-ropc-nochange
88
ms.date: 4/10/2024
99
uid: blazor/js-interop/call-javascript-from-dotnet
1010
---

aspnetcore/blazor/progressive-web-app/push-notifications.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
---
22
title: Push notifications for ASP.NET Core Blazor Progressive Web Applications (PWAs)
3+
ai-usage: ai-assisted
34
author: guardrex
45
description: Learn how to issue push notifications in Blazor Progressive Web Applications (PWAs).
56
monikerRange: '>= aspnetcore-3.1'
67
ms.author: wpickett
78
ms.custom: mvc
8-
ms.date: 07/07/2025
9+
ms.date: 07/30/2025
910
uid: blazor/progressive-web-app/push-notifications
1011
---
1112
# Push notifications for ASP.NET Core Blazor Progressive Web Applications (PWAs)
@@ -30,24 +31,21 @@ The example in this article uses push notifications to provide order status upda
3031

3132
Generate the cryptographic public and private keys for securing push notifications either locally, for example with PowerShell or IIS, or using an online tool.
3233

33-
> [!CAUTION]
34-
> This article's use of a unencrypted, insecure private key in the app's code ***is for demonstration purposes and local testing only.*** We recommend using a secure approach for supplying a private key to an ASP.NET Core app at all stages of development. When working locally in the Development environment, a private key can be provided to the app using the [Secret Manager](xref:security/app-secrets#secret-manager) tool. In Development, Staging, and Production environments, [Azure Key Vault](/azure/key-vault/) with [Azure Managed Identities](/entra/identity/managed-identities-azure-resources/overview) can be used, noting in passing that to obtain a certificate's private key from a key vault that the certificate must have an exportable private key.
35-
36-
<!-- We'll expand this article to include explicit guidance on key management with AKV. A
37-
Google search with 'get certificate private key from azure key vault for use in c# code'
38-
generates a decent code sample. I didn't see such a good starting point in AKV Learn
39-
articles, so we'll use the AI-generated code as a starting point.
40-
41-
The preceding CAUTION statement also appears in the 'Send a notification' section.
42-
-->
43-
4434
Placeholders used in this article's example code:
4535

4636
* `{PUBLIC KEY}`: The public key.
4737
* `{PRIVATE KEY}`: The private key.
4838

4939
For this article's C# examples, update the `[email protected]` email address to match the address used when creating the custom key pair.
5040

41+
When implementing push notifications, ensure that cryptographic keys are managed securely:
42+
43+
* **Key generation**: Use a trusted library or tool to generate the public and private keys. Avoid using weak or outdated algorithms.
44+
* **Key storage**: Store private keys securely on the server, using a secure storage mechanism such as a hardware security module (HSM) or encrypted storage. Never expose private keys to the client.
45+
* **Key usage**: Use the private key only for signing push notification payloads. Ensure that the public key is distributed securely to clients.
46+
47+
For more information on cryptographic best practices, see [Cryptographic Services](/dotnet/standard/security/cryptographic-services).
48+
5149
## Create a subscription
5250

5351
Before sending push notifications to a user, the app must ask the user for permission. If they grant permission to receive notifications, their browser generates a *subscription*, which includes a set of tokens the app can use to route notifications to the user.
@@ -258,7 +256,7 @@ Sending a notification involves performing some complex cryptographic operations
258256
The `SendNotificationAsync` method dispatches order notifications using the captured subscription. The following code makes uses of `WebPush` APIs for dispatching the notification. The payload of the notification is JSON serialized and includes a message and a URL. The message is displayed to the user, and the URL allows the user to reach the pizza order associated with the notification. Additional parameters can be serialized as required for other notification scenarios.
259257

260258
> [!CAUTION]
261-
> This article's use of a unencrypted, insecure private key in the app's code ***is for demonstration purposes and local testing only.*** We recommend using a secure approach for supplying a private key to an ASP.NET Core app at all stages of development. When working locally in the Development environment, a private key can be provided to the app using the [Secret Manager](xref:security/app-secrets#secret-manager) tool. In Development, Staging, and Production environments, [Azure Key Vault](/azure/key-vault/) with [Azure Managed Identities](/entra/identity/managed-identities-azure-resources/overview) can be used, noting in passing that to obtain a certificate's private key from a key vault that the certificate must have an exportable private key.
259+
> In the following example, we recommend using a secure approach for supplying the private key. When working locally in the Development environment, a private key can be provided to the app using the [Secret Manager](xref:security/app-secrets#secret-manager) tool. In Development, Staging, and Production environments, [Azure Key Vault](/azure/key-vault/) with [Azure Managed Identities](/entra/identity/managed-identities-azure-resources/overview) can be used, noting in passing that to obtain a certificate's private key from a key vault that the certificate must have an exportable private key.
262260
263261
```csharp
264262
private static async Task SendNotificationAsync(Order order,

aspnetcore/blazor/security/blazor-web-app-with-entra.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: guardrex
44
description: Learn how to secure a Blazor Web App with Microsoft Entra ID.
55
monikerRange: '>= aspnetcore-9.0'
66
ms.author: wpickett
7-
ms.custom: mvc
7+
ms.custom: mvc, sfi-ropc-nochange
88
ms.date: 07/29/2025
99
uid: blazor/security/blazor-web-app-entra
1010
zone_pivot_groups: blazor-web-app-entra-specification

aspnetcore/blazor/security/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -535,13 +535,13 @@ Two additional abstractions participate in managing authentication state:
535535

536536
* <xref:Microsoft.AspNetCore.Components.Server.RevalidatingServerAuthenticationStateProvider> ([reference source](https://github.com/dotnet/aspnetcore/blob/main/src/Components/Server/src/Circuits/RevalidatingServerAuthenticationStateProvider.cs)): A base class for <xref:Microsoft.AspNetCore.Components.Authorization.AuthenticationStateProvider> services used by the Blazor framework to receive an authentication state from the host environment and revalidate it at regular intervals.
537537

538-
The default 30 minute revalidation interval can be adjusted in [`RevalidatingIdentityAuthenticationStateProvider` (reference source)](https://github.com/dotnet/aspnetcore/blob/v7.0.0/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Areas/Identity/RevalidatingIdentityAuthenticationStateProvider.cs#L26). The following example shortens the interval to 20 minutes:
538+
[!INCLUDE[](~/includes/aspnetcore-repo-ref-source-links.md)]
539539

540-
```csharp
541-
protected override TimeSpan RevalidationInterval => TimeSpan.FromMinutes(20);
542-
```
540+
In apps generated from the Blazor project template for .NET 8 or later, adjust the default 30 minute revalidation interval in `IdentityRevalidatingAuthenticationStateProvider`. Earlier than .NET 8, adjust the interval in `RevalidatingIdentityAuthenticationStateProvider`. The following example shortens the interval to 20 minutes:
543541

544-
[!INCLUDE[](~/includes/aspnetcore-repo-ref-source-links.md)]
542+
```csharp
543+
protected override TimeSpan RevalidationInterval => TimeSpan.FromMinutes(20);
544+
```
545545

546546
### Authentication state management at sign out
547547

aspnetcore/blazor/security/webassembly/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: guardrex
44
description: Learn how to secure Blazor WebAssembly apps as single-page applications (SPAs).
55
monikerRange: '>= aspnetcore-3.1'
66
ms.author: wpickett
7-
ms.custom: mvc
7+
ms.custom: mvc, sfi-ropc-nochange
88
ms.date: 11/12/2024
99
uid: blazor/security/webassembly/index
1010
---

aspnetcore/blazor/security/webassembly/standalone-with-microsoft-accounts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: guardrex
44
description: Learn how to secure an ASP.NET Core Blazor WebAssembly standalone app with Microsoft Accounts.
55
monikerRange: '>= aspnetcore-3.1'
66
ms.author: wpickett
7-
ms.custom: mvc
7+
ms.custom: mvc, sfi-ropc-nochange
88
ms.date: 04/07/2025
99
uid: blazor/security/webassembly/standalone-with-microsoft-accounts
1010
---

aspnetcore/blazor/security/webassembly/standalone-with-microsoft-entra-id.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: guardrex
44
description: Learn how to secure an ASP.NET Core Blazor WebAssembly standalone app with Microsoft Entra ID.
55
monikerRange: '>= aspnetcore-3.1'
66
ms.author: wpickett
7-
ms.custom: "devx-track-csharp, mvc"
7+
ms.custom: devx-track-csharp, mvc, sfi-ropc-nochange
88
ms.date: 04/07/2025
99
uid: blazor/security/webassembly/standalone-with-microsoft-entra-id
1010
---

0 commit comments

Comments
 (0)