From 6e1baf48b52d0e745cba49fcfc7740417cf1aafa Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Mon, 7 Apr 2025 18:40:07 -0400 Subject: [PATCH 1/6] Remove two Razor example files (#35165) --- .../blazor/security/includes/imports-file-hosted.md | 3 --- .../security/includes/imports-file-standalone.md | 3 --- .../blazor/security/includes/imports-hosted.razor | 11 ----------- .../blazor/security/includes/imports-standalone.razor | 11 ----------- .../hosted-with-azure-active-directory-b2c.md | 10 ++++++++-- .../webassembly/hosted-with-identity-server.md | 10 ++++++++-- .../webassembly/hosted-with-microsoft-entra-id.md | 10 ++++++++-- .../standalone-with-authentication-library.md | 10 ++++++++-- .../standalone-with-azure-active-directory-b2c.md | 10 ++++++++-- .../webassembly/standalone-with-microsoft-accounts.md | 10 ++++++++-- .../webassembly/standalone-with-microsoft-entra-id.md | 10 ++++++++-- 11 files changed, 56 insertions(+), 42 deletions(-) delete mode 100644 aspnetcore/blazor/security/includes/imports-file-hosted.md delete mode 100644 aspnetcore/blazor/security/includes/imports-file-standalone.md delete mode 100644 aspnetcore/blazor/security/includes/imports-hosted.razor delete mode 100644 aspnetcore/blazor/security/includes/imports-standalone.razor diff --git a/aspnetcore/blazor/security/includes/imports-file-hosted.md b/aspnetcore/blazor/security/includes/imports-file-hosted.md deleted file mode 100644 index 7d6b0724aa85..000000000000 --- a/aspnetcore/blazor/security/includes/imports-file-hosted.md +++ /dev/null @@ -1,3 +0,0 @@ -The namespace is made available throughout the app via the `_Imports.razor` file: - -[!code-razor[](imports-hosted.razor?highlight=3)] diff --git a/aspnetcore/blazor/security/includes/imports-file-standalone.md b/aspnetcore/blazor/security/includes/imports-file-standalone.md deleted file mode 100644 index 116aaf1f4045..000000000000 --- a/aspnetcore/blazor/security/includes/imports-file-standalone.md +++ /dev/null @@ -1,3 +0,0 @@ -The namespace is made available throughout the app via the `_Imports.razor` file: - -[!code-razor[](imports-standalone.razor?highlight=3)] diff --git a/aspnetcore/blazor/security/includes/imports-hosted.razor b/aspnetcore/blazor/security/includes/imports-hosted.razor deleted file mode 100644 index 65c6746a22dd..000000000000 --- a/aspnetcore/blazor/security/includes/imports-hosted.razor +++ /dev/null @@ -1,11 +0,0 @@ -@using System.Net.Http -@using System.Net.Http.Json -@using Microsoft.AspNetCore.Components.Authorization -@using Microsoft.AspNetCore.Components.Forms -@using Microsoft.AspNetCore.Components.Routing -@using Microsoft.AspNetCore.Components.Web -@using Microsoft.AspNetCore.Components.Web.Virtualization -@using Microsoft.AspNetCore.Components.WebAssembly.Http -@using Microsoft.JSInterop -@using {APPLICATION ASSEMBLY} -@using {APPLICATION ASSEMBLY}.Shared diff --git a/aspnetcore/blazor/security/includes/imports-standalone.razor b/aspnetcore/blazor/security/includes/imports-standalone.razor deleted file mode 100644 index 65c6746a22dd..000000000000 --- a/aspnetcore/blazor/security/includes/imports-standalone.razor +++ /dev/null @@ -1,11 +0,0 @@ -@using System.Net.Http -@using System.Net.Http.Json -@using Microsoft.AspNetCore.Components.Authorization -@using Microsoft.AspNetCore.Components.Forms -@using Microsoft.AspNetCore.Components.Routing -@using Microsoft.AspNetCore.Components.Web -@using Microsoft.AspNetCore.Components.Web.Virtualization -@using Microsoft.AspNetCore.Components.WebAssembly.Http -@using Microsoft.JSInterop -@using {APPLICATION ASSEMBLY} -@using {APPLICATION ASSEMBLY}.Shared diff --git a/aspnetcore/blazor/security/webassembly/hosted-with-azure-active-directory-b2c.md b/aspnetcore/blazor/security/webassembly/hosted-with-azure-active-directory-b2c.md index cdcc2d073d0e..e382d2c86c07 100644 --- a/aspnetcore/blazor/security/webassembly/hosted-with-azure-active-directory-b2c.md +++ b/aspnetcore/blazor/security/webassembly/hosted-with-azure-active-directory-b2c.md @@ -5,7 +5,7 @@ description: Learn how to secure a hosted ASP.NET Core Blazor WebAssembly app wi monikerRange: '>= aspnetcore-3.1 < aspnetcore-8.0' ms.author: riande ms.custom: mvc -ms.date: 11/12/2024 +ms.date: 04/07/2025 uid: blazor/security/webassembly/hosted-with-azure-active-directory-b2c --- # Secure a hosted ASP.NET Core Blazor WebAssembly app with Azure Active Directory B2C @@ -378,7 +378,13 @@ For more information, see the following sections of the *Additional scenarios* a *This section pertains to the solution's **:::no-loc text="Client":::** app.* -[!INCLUDE[](~/blazor/security/includes/imports-file-hosted.md)] +The namespace is made available throughout the app via the `_Imports.razor` file: + +```razor +... +@using Microsoft.AspNetCore.Components.Authorization +... +``` ### Index page diff --git a/aspnetcore/blazor/security/webassembly/hosted-with-identity-server.md b/aspnetcore/blazor/security/webassembly/hosted-with-identity-server.md index 90a10310615e..23beb7de9be6 100644 --- a/aspnetcore/blazor/security/webassembly/hosted-with-identity-server.md +++ b/aspnetcore/blazor/security/webassembly/hosted-with-identity-server.md @@ -5,7 +5,7 @@ description: Learn how to secure a hosted ASP.NET Core Blazor WebAssembly app wi monikerRange: '>= aspnetcore-3.1 < aspnetcore-8.0' ms.author: riande ms.custom: mvc, linux-related-content -ms.date: 11/12/2024 +ms.date: 04/07/2025 uid: blazor/security/webassembly/hosted-with-identity-server --- # Secure a hosted ASP.NET Core Blazor WebAssembly app with Identity Server @@ -292,7 +292,13 @@ Configuration for the app is loaded by convention from `_configuration/{client-i *This section pertains to the solution's **:::no-loc text="Client":::** app.* -[!INCLUDE[](~/blazor/security/includes/imports-file-hosted.md)] +The namespace is made available throughout the app via the `_Imports.razor` file: + +```razor +... +@using Microsoft.AspNetCore.Components.Authorization +... +``` ### `Index` page diff --git a/aspnetcore/blazor/security/webassembly/hosted-with-microsoft-entra-id.md b/aspnetcore/blazor/security/webassembly/hosted-with-microsoft-entra-id.md index 629d83cdbda2..89e876247f1c 100644 --- a/aspnetcore/blazor/security/webassembly/hosted-with-microsoft-entra-id.md +++ b/aspnetcore/blazor/security/webassembly/hosted-with-microsoft-entra-id.md @@ -5,7 +5,7 @@ description: Learn how to secure a hosted ASP.NET Core Blazor WebAssembly app wi monikerRange: '>= aspnetcore-3.1 < aspnetcore-8.0' ms.author: riande ms.custom: "devx-track-csharp, mvc" -ms.date: 11/12/2024 +ms.date: 04/07/2025 uid: blazor/security/webassembly/hosted-with-microsoft-entra-id --- # Secure a hosted ASP.NET Core Blazor WebAssembly app with Microsoft Entra ID @@ -384,7 +384,13 @@ For more information, see the following sections of the *Additional scenarios* a *This section pertains to the solution's **:::no-loc text="Client":::** app.* -[!INCLUDE[](~/blazor/security/includes/imports-file-hosted.md)] +The namespace is made available throughout the app via the `_Imports.razor` file: + +```razor +... +@using Microsoft.AspNetCore.Components.Authorization +... +``` ### Index page diff --git a/aspnetcore/blazor/security/webassembly/standalone-with-authentication-library.md b/aspnetcore/blazor/security/webassembly/standalone-with-authentication-library.md index 5b7f1aba8474..07b5ccd07b7b 100644 --- a/aspnetcore/blazor/security/webassembly/standalone-with-authentication-library.md +++ b/aspnetcore/blazor/security/webassembly/standalone-with-authentication-library.md @@ -5,7 +5,7 @@ description: Learn how to secure an ASP.NET Core Blazor WebAssembly standalone a monikerRange: '>= aspnetcore-3.1' ms.author: riande ms.custom: mvc -ms.date: 11/12/2024 +ms.date: 04/07/2025 uid: blazor/security/webassembly/standalone-with-authentication-library --- # Secure an ASP.NET Core Blazor WebAssembly standalone app with the Authentication library @@ -188,7 +188,13 @@ For more information, see the following sections of the *Additional scenarios* a ### Imports file -[!INCLUDE[](~/blazor/security/includes/imports-file-standalone.md)] +The namespace is made available throughout the app via the `_Imports.razor` file: + +```razor +... +@using Microsoft.AspNetCore.Components.Authorization +... +``` ### Index page diff --git a/aspnetcore/blazor/security/webassembly/standalone-with-azure-active-directory-b2c.md b/aspnetcore/blazor/security/webassembly/standalone-with-azure-active-directory-b2c.md index efeea36bfd26..bad7dce275eb 100644 --- a/aspnetcore/blazor/security/webassembly/standalone-with-azure-active-directory-b2c.md +++ b/aspnetcore/blazor/security/webassembly/standalone-with-azure-active-directory-b2c.md @@ -5,7 +5,7 @@ description: Learn how to secure an ASP.NET Core Blazor WebAssembly standalone a monikerRange: '>= aspnetcore-3.1' ms.author: riande ms.custom: mvc -ms.date: 11/12/2024 +ms.date: 04/07/2025 uid: blazor/security/webassembly/standalone-with-azure-active-directory-b2c --- # Secure an ASP.NET Core Blazor WebAssembly standalone app with Azure Active Directory B2C @@ -190,7 +190,13 @@ For more information, see the following sections of the *Additional scenarios* a ### Imports file -[!INCLUDE[](~/blazor/security/includes/imports-file-standalone.md)] +The namespace is made available throughout the app via the `_Imports.razor` file: + +```razor +... +@using Microsoft.AspNetCore.Components.Authorization +... +``` ### Index page diff --git a/aspnetcore/blazor/security/webassembly/standalone-with-microsoft-accounts.md b/aspnetcore/blazor/security/webassembly/standalone-with-microsoft-accounts.md index 41ed5963cca3..5f413aa2c8b5 100644 --- a/aspnetcore/blazor/security/webassembly/standalone-with-microsoft-accounts.md +++ b/aspnetcore/blazor/security/webassembly/standalone-with-microsoft-accounts.md @@ -5,7 +5,7 @@ description: Learn how to secure an ASP.NET Core Blazor WebAssembly standalone a monikerRange: '>= aspnetcore-3.1' ms.author: riande ms.custom: mvc -ms.date: 11/12/2024 +ms.date: 04/07/2025 uid: blazor/security/webassembly/standalone-with-microsoft-accounts --- # Secure an ASP.NET Core Blazor WebAssembly standalone app with Microsoft Accounts @@ -171,7 +171,13 @@ For more information, see the following sections of the *Additional scenarios* a ### Imports file -[!INCLUDE[](~/blazor/security/includes/imports-file-standalone.md)] +The namespace is made available throughout the app via the `_Imports.razor` file: + +```razor +... +@using Microsoft.AspNetCore.Components.Authorization +... +``` ### Index page diff --git a/aspnetcore/blazor/security/webassembly/standalone-with-microsoft-entra-id.md b/aspnetcore/blazor/security/webassembly/standalone-with-microsoft-entra-id.md index e4236da8360a..6473b8121955 100644 --- a/aspnetcore/blazor/security/webassembly/standalone-with-microsoft-entra-id.md +++ b/aspnetcore/blazor/security/webassembly/standalone-with-microsoft-entra-id.md @@ -5,7 +5,7 @@ description: Learn how to secure an ASP.NET Core Blazor WebAssembly standalone a monikerRange: '>= aspnetcore-3.1' ms.author: riande ms.custom: "devx-track-csharp, mvc" -ms.date: 11/12/2024 +ms.date: 04/07/2025 uid: blazor/security/webassembly/standalone-with-microsoft-entra-id --- # Secure an ASP.NET Core Blazor WebAssembly standalone app with Microsoft Entra ID @@ -172,7 +172,13 @@ For more information, see the following resources: ### Imports file -[!INCLUDE[](~/blazor/security/includes/imports-file-standalone.md)] +The namespace is made available throughout the app via the `_Imports.razor` file: + +```razor +... +@using Microsoft.AspNetCore.Components.Authorization +... +``` ### Index page From 786bccc880acb16ed4a06ae754f9d265d39ab962 Mon Sep 17 00:00:00 2001 From: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com> Date: Mon, 7 Apr 2025 13:43:11 -1000 Subject: [PATCH 2/6] Update action-return-types.md (#35151) * Update action-return-types.md * Update aspnetcore/web-api/action-return-types.md --- aspnetcore/web-api/action-return-types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/web-api/action-return-types.md b/aspnetcore/web-api/action-return-types.md index 9e7b39c7a027..0ebdb4e59206 100644 --- a/aspnetcore/web-api/action-return-types.md +++ b/aspnetcore/web-api/action-return-types.md @@ -160,7 +160,7 @@ The `HttpResults` can be useful when sharing code between Minimal APIs and Web A The namespace contains classes that implement the interface. The `IResult` interface defines a contract that represents the result of an HTTP endpoint. The static [Results]() class is used to create varying `IResult` objects that represent different types of responses. -The [Built-in results](/aspnet/core/fundamentals/minimal-apis?view=aspnetcore-7.0&preserve-view=true#binr7) table shows the common result helpers. +The [Built-in results](/aspnet/core/fundamentals/minimal-apis#built-in-results) table shows the common result helpers. Consider the following code: From 9006424ca931ccda1026448661dc73941074a075 Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Tue, 8 Apr 2025 07:40:06 +0200 Subject: [PATCH 3/6] corrections in First mongo app (#35163) * Closes #35134 * Closes #35133 * Closes #35131 * fix invalid path --- aspnetcore/tutorials/first-mongo-app.md | 13 ++++++------- .../first-mongo-app/includes/first-mongo-app3-5.md | 1 + .../first-mongo-app/includes/first-mongo-app6.md | 7 +++---- .../first-mongo-app/includes/first-mongo-app7.md | 7 +++---- .../first-mongo-app/includes/first-mongo-app8.md | 14 ++++++-------- 5 files changed, 19 insertions(+), 23 deletions(-) diff --git a/aspnetcore/tutorials/first-mongo-app.md b/aspnetcore/tutorials/first-mongo-app.md index 15c0b47656af..f8111ffba171 100644 --- a/aspnetcore/tutorials/first-mongo-app.md +++ b/aspnetcore/tutorials/first-mongo-app.md @@ -50,10 +50,10 @@ Enable MongoDB and MongoDB Shell access from anywhere on the development machine 1. Download and Install MongoDB Shell: * macOS/Linux: Choose a directory to extract the MongoDB Shell to. Add the resulting path for `mongosh` to the `PATH` environment variable. - * Windows: MongoDB Shell (mongosh.exe) is installed at *C:\Users\\AppData\Local\Programs\mongosh*. Add the resulting path for `mongosh.exe` to the `PATH` environment variable. + * Windows: MongoDB Shell (mongosh.exe) is installed at *C:\\Users\\\\\AppData\\Local\\Programs\\mongosh*. Add the resulting path for `mongosh.exe` to the `PATH` environment variable. 1. Download and Install MongoDB: * macOS/Linux: Verify the directory that MongoDB was installed at, usually in */usr/local/mongodb*. Add the resulting path for `mongodb` to the `PATH` environment variable. - * Windows: MongoDB is installed at *C:\\Program Files\MongoDB* by default. Add *C:\\Program Files\\MongoDB\\Server\\\\\bin* to the `PATH` environment variable. + * Windows: MongoDB is installed at *C:\\Program Files\\MongoDB* by default. Add *C:\\Program Files\\MongoDB\\Server\\\\\bin* to the `PATH` environment variable. 1. Choose a Data Storage Directory: Select a directory on your development machine for storing data. Create the directory if it doesn't exist. The MongoDB Shell doesn't create new directories: * macOS/Linux: For example, `/usr/local/var/mongodb`. * Windows: For example, `C:\\BooksData`. @@ -65,14 +65,13 @@ Enable MongoDB and MongoDB Shell access from anywhere on the development machine Use the previously installed MongoDB Shell in the following steps to create a database, make collections, and store documents. For more information on MongoDB Shell commands, see [`mongosh`](https://docs.mongodb.com/mongodb-shell/run-commands/). -1. Open a MongoDB command shell instance by launching `mongosh.exe`. -1. In the command shell, connect to the default test database by running the following command: +1. Open a MongoDB command shell instance by launching `mongosh.exe`, or by running the following command in the command shell: ```console mongosh ``` -1. Run the following command in the command shell: +1. In the command shell connect to the default test database by running: ```console use BookStore @@ -268,7 +267,7 @@ The preceding web API controller: 1. Build and run the app. -1. Navigate to `https://localhost:/api/books`, where `` is the automatically assigned port number for the app, to test the controller's parameterless `Get` action method, select **Try it out** > **Execute**. A JSON response similar to the following is displayed: +1. Navigate to `https://localhost:/api/books`, where `` is the automatically assigned port number for the app, to test the controller's parameterless `Get` action method. A JSON response similar to the following is displayed: ```json [ @@ -334,7 +333,7 @@ To satisfy the preceding requirements, make the following changes: ## Additional resources -* [View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/tutorials/first-mongo-app/samples) ([how to download](xref:index#how-to-download-a-sample)) +* [View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/tutorials/first-mongo-app/samples/8.x/BookStoreApi) ([how to download](xref:index#how-to-download-a-sample)) * * * [Create a web API with ASP.NET Core](/training/modules/build-web-api-aspnet-core/) diff --git a/aspnetcore/tutorials/first-mongo-app/includes/first-mongo-app3-5.md b/aspnetcore/tutorials/first-mongo-app/includes/first-mongo-app3-5.md index 09ee103e6022..1395e50803e6 100644 --- a/aspnetcore/tutorials/first-mongo-app/includes/first-mongo-app3-5.md +++ b/aspnetcore/tutorials/first-mongo-app/includes/first-mongo-app3-5.md @@ -354,6 +354,7 @@ To satisfy the preceding requirements, make the following changes: For more information on building ASP.NET Core web APIs, see the following resources: +* [View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/tutorials/first-mongo-app/samples/3.x/SampleApp) ([how to download](xref:index#how-to-download-a-sample)) * [YouTube version of this article](https://www.youtube.com/watch?v=7uJt_sOenyo&feature=youtu.be) * * diff --git a/aspnetcore/tutorials/first-mongo-app/includes/first-mongo-app6.md b/aspnetcore/tutorials/first-mongo-app/includes/first-mongo-app6.md index 14513488da03..b6173c0c6d0b 100644 --- a/aspnetcore/tutorials/first-mongo-app/includes/first-mongo-app6.md +++ b/aspnetcore/tutorials/first-mongo-app/includes/first-mongo-app6.md @@ -45,14 +45,13 @@ Enable MongoDB and Mongo DB Shell access from anywhere on the development machin Use the previously installed MongoDB Shell in the following steps to create a database, make collections, and store documents. For more information on MongoDB Shell commands, see [`mongosh`](https://docs.mongodb.com/mongodb-shell/run-commands/). -1. Open a MongoDB command shell instance by launching `mongosh.exe`. -1. In the command shell connect to the default test database by running the following command: +1. Open a MongoDB command shell instance by launching `mongosh.exe`, or by running the following command in the command shell: ```console mongosh ``` -1. Run the following command in the command shell: +1. In the command shell connect to the default test database by running: ```console use BookStore @@ -320,7 +319,7 @@ To satisfy the preceding requirements, make the following changes: ## Additional resources -* [View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/tutorials/first-mongo-app/samples) ([how to download](xref:index#how-to-download-a-sample)) +* [View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/tutorials/first-mongo-app/samples/6.x/BookStoreApi) ([how to download](xref:index#how-to-download-a-sample)) * * * [Create a web API with ASP.NET Core](/training/modules/build-web-api-aspnet-core/) diff --git a/aspnetcore/tutorials/first-mongo-app/includes/first-mongo-app7.md b/aspnetcore/tutorials/first-mongo-app/includes/first-mongo-app7.md index 56a42cbe2a5c..92c198a4564b 100644 --- a/aspnetcore/tutorials/first-mongo-app/includes/first-mongo-app7.md +++ b/aspnetcore/tutorials/first-mongo-app/includes/first-mongo-app7.md @@ -45,14 +45,13 @@ Enable MongoDB and Mongo DB Shell access from anywhere on the development machin Use the previously installed MongoDB Shell in the following steps to create a database, make collections, and store documents. For more information on MongoDB Shell commands, see [`mongosh`](https://docs.mongodb.com/mongodb-shell/run-commands/). -1. Open a MongoDB command shell instance by launching `mongosh.exe`. -1. In the command shell connect to the default test database by running the following command: +1. Open a MongoDB command shell instance by launching `mongosh.exe`, or by running the following command in the command shell: ```console mongosh ``` -1. Run the following command in the command shell: +1. In the command shell connect to the default test database by running: ```console use BookStore @@ -321,7 +320,7 @@ To satisfy the preceding requirements, make the following changes: ## Additional resources -* [View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/tutorials/first-mongo-app/samples) ([how to download](xref:index#how-to-download-a-sample)) +* [View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/tutorials/first-mongo-app/samples/7.x/BookStoreApi) ([how to download](xref:index#how-to-download-a-sample)) * * * [Create a web API with ASP.NET Core](/training/modules/build-web-api-aspnet-core/) diff --git a/aspnetcore/tutorials/first-mongo-app/includes/first-mongo-app8.md b/aspnetcore/tutorials/first-mongo-app/includes/first-mongo-app8.md index ff275e3a87be..6af18426df2b 100644 --- a/aspnetcore/tutorials/first-mongo-app/includes/first-mongo-app8.md +++ b/aspnetcore/tutorials/first-mongo-app/includes/first-mongo-app8.md @@ -37,10 +37,10 @@ Enable MongoDB and MongoDB Shell access from anywhere on the development machine 1. Download and Install MongoDB Shell: * macOS/Linux: Choose a directory to extract the MongoDB Shell to. Add the resulting path for `mongosh` to the `PATH` environment variable. - * Windows: MongoDB Shell (mongosh.exe) is installed at *C:\Users\\AppData\Local\Programs\mongosh*. Add the resulting path for `mongosh.exe` to the `PATH` environment variable. + * Windows: MongoDB Shell (mongosh.exe) is installed at *C:\\Users\\\\\AppData\\Local\\Programs\\mongosh*. Add the resulting path for `mongosh.exe` to the `PATH` environment variable. 1. Download and Install MongoDB: * macOS/Linux: Verify the directory that MongoDB was installed at, usually in */usr/local/mongodb*. Add the resulting path for `mongodb` to the `PATH` environment variable. - * Windows: MongoDB is installed at *C:\\Program Files\MongoDB* by default. Add *C:\\Program Files\\MongoDB\\Server\\\\\bin* to the `PATH` environment variable. + * Windows: MongoDB is installed at *C:\\Program Files\\MongoDB* by default. Add *C:\\Program Files\\MongoDB\\Server\\\\\bin* to the `PATH` environment variable. 1. Choose a Data Storage Directory: Select a directory on your development machine for storing data. Create the directory if it doesn't exist. The MongoDB Shell doesn't create new directories: * macOS/Linux: For example, `/usr/local/var/mongodb`. * Windows: For example, `C:\\BooksData`. @@ -52,15 +52,13 @@ Enable MongoDB and MongoDB Shell access from anywhere on the development machine Use the previously installed MongoDB Shell in the following steps to create a database, make collections, and store documents. For more information on MongoDB Shell commands, see [`mongosh`](https://docs.mongodb.com/mongodb-shell/run-commands/). -1. Open a MongoDB command shell instance by launching `mongosh.exe`. -1. In the command shell, connect to the default test database by running the following command: +1. Open a MongoDB command shell instance by launching `mongosh.exe`, or by running the following command in the command shell: ```console mongosh ``` -1. Run the following command in the command shell: - +1. In the command shell connect to the default test database by running: ```console use BookStore ``` @@ -262,7 +260,7 @@ The preceding web API controller: 1. Build and run the app. -1. Navigate to `https://localhost:/api/books`, where `` is the automatically assigned port number for the app, to test the controller's parameterless `Get` action method, select **Try it out** > **Execute**. A JSON response similar to the following is displayed: +1. Navigate to `https://localhost:/api/books`, where `` is the automatically assigned port number for the app, to test the controller's parameterless `Get` action method. A JSON response similar to the following is displayed: ```json [ @@ -328,7 +326,7 @@ To satisfy the preceding requirements, make the following changes: ## Additional resources -* [View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/tutorials/first-mongo-app/samples) ([how to download](xref:index#how-to-download-a-sample)) +* [View or download sample code](https://github.com/dotnet/AspNetCore.Docs/tree/main/aspnetcore/tutorials/first-mongo-app/samples/8.x/BookStoreApi) ([how to download](xref:index#how-to-download-a-sample)) * * * [Create a web API with ASP.NET Core](/training/modules/build-web-api-aspnet-core/) From 3a74a1791e604fb8195f338a7a6bc4267c935f82 Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Tue, 8 Apr 2025 07:23:24 -0400 Subject: [PATCH 4/6] [Pre3] Blazor WASM fingerprinting and environment property (#35057) --- .../blazor/components/built-in-components.md | 2 +- .../blazor/fundamentals/environments.md | 60 ++++++++++++---- .../blazor/fundamentals/static-files.md | 60 +++++++++++++++- aspnetcore/fundamentals/map-static-files.md | 2 +- .../aspnetcore-10/includes/blazor.md | 70 +++++++++++++++++++ 5 files changed, 175 insertions(+), 19 deletions(-) diff --git a/aspnetcore/blazor/components/built-in-components.md b/aspnetcore/blazor/components/built-in-components.md index 2bd4b5fcdf9c..05470eb88d2e 100644 --- a/aspnetcore/blazor/components/built-in-components.md +++ b/aspnetcore/blazor/components/built-in-components.md @@ -27,7 +27,7 @@ The following built-in Razor components are provided by the Blazor framework. Fo * [`FocusOnNavigate`](xref:blazor/fundamentals/routing#focus-an-element-on-navigation) * [`HeadContent`](xref:blazor/components/control-head-content) * [`HeadOutlet`](xref:blazor/components/control-head-content) -* [`ImportMap`](xref:blazor/fundamentals/static-files#import-maps) +* [`ImportMap`](xref:blazor/fundamentals/static-files#importmap-component) * [`InputCheckbox`](xref:blazor/forms/input-components) * [`InputDate`](xref:blazor/forms/input-components) * [`InputFile`](xref:blazor/file-uploads) diff --git a/aspnetcore/blazor/fundamentals/environments.md b/aspnetcore/blazor/fundamentals/environments.md index c233906a468c..7a3020b39cbf 100644 --- a/aspnetcore/blazor/fundamentals/environments.md +++ b/aspnetcore/blazor/fundamentals/environments.md @@ -28,34 +28,58 @@ We recommend the following conventions: ## Set the environment -:::moniker range=">= aspnetcore-8.0" - The environment is set using any of the following approaches: -* Blazor Web App: Use any of the approaches described in for general ASP.NET Core apps. -* Blazor Web App or standalone Blazor WebAssembly: [Blazor start configuration](#set-the-client-side-environment-via-blazor-startup-configuration) -* Standalone Blazor WebAssembly: [`Blazor-Environment` header](#set-the-client-side-environment-via-header) -* Blazor Web App or standalone Blazor WebAssembly: [Azure App Service](#set-the-environment-for-azure-app-service) +:::moniker range=">= aspnetcore-10.0" + +* Blazor Web App or Blazor Server: Use any of the approaches described in for general ASP.NET Core apps. +* Any Blazor app: [Blazor start configuration](#set-the-client-side-environment-via-blazor-startup-configuration) +* Standalone Blazor WebAssembly: `` property + +On the client for a Blazor Web App, the environment is determined from the server via an HTML comment that developers don't interact with: + +```html + +``` + +For a standalone Blazor WebAssembly app, set the environment with the `` property in the app's project file (`.csproj`). The following example sets the `Staging` environment: + +```xml +Staging +``` + +The default environments are `Development` for build and `Production` for publish. + +:::moniker-end + +:::moniker range=">= aspnetcore-8.0 < aspnetcore-10.0" + +* Blazor Web App or Blazor Server: Use any of the approaches described in for general ASP.NET Core apps. +* Any Blazor app: + * [Blazor start configuration](#set-the-client-side-environment-via-blazor-startup-configuration) + * [Azure App Service](#set-the-environment-for-azure-app-service) +* Blazor WebAssembly: [`Blazor-Environment` header](#set-the-client-side-environment-via-header) On the client for a Blazor Web App, the environment is determined from the server via a middleware that communicates the environment to the browser via a header named `Blazor-Environment`. The header sets the environment when the is created in the client-side `Program` file (). +For a standalone Blazor WebAssembly app running locally, the development server adds the `Blazor-Environment` header with the environment name obtained from the hosting environment. The hosting environment sets the environment from the `ASPNETCORE_ENVIRONMENT` environment variable established by the project's `Properties/launchSettings.json` file. The default value of the environment variable in a project created from the Blazor WebAssembly project template is `Development`. For more information, see the [Set the client-side environment via header](#set-the-client-side-environment-via-header) section. + :::moniker-end :::moniker range="< aspnetcore-8.0" -The environment is set using any of the following approaches: - * Blazor Server: Use any of the approaches described in for general ASP.NET Core apps. -* Blazor Server or Blazor WebAssembly: [Blazor start configuration](#set-the-client-side-environment-via-blazor-startup-configuration) +* Blazor Server or Blazor WebAssembly: + * [Blazor start configuration](#set-the-client-side-environment-via-blazor-startup-configuration) + * [Azure App Service](#set-the-environment-for-azure-app-service) * Blazor WebAssembly: [`Blazor-Environment` header](#set-the-client-side-environment-via-header) -* Blazor Server or Blazor WebAssembly: [Azure App Service](#set-the-environment-for-azure-app-service) - -On the client for a Blazor Web App or the client of a hosted Blazor WebAssembly app, the environment is determined from the server via a middleware that communicates the environment to the browser via a header named `Blazor-Environment`. The header sets the environment when the is created in the client-side `Program` file (). -:::moniker-end +On the client of a hosted Blazor WebAssembly app, the environment is determined from the server via a middleware that communicates the environment to the browser via a header named `Blazor-Environment`. The header sets the environment when the is created in the client-side `Program` file (). For a standalone Blazor WebAssembly app running locally, the development server adds the `Blazor-Environment` header with the environment name obtained from the hosting environment. The hosting environment sets the environment from the `ASPNETCORE_ENVIRONMENT` environment variable established by the project's `Properties/launchSettings.json` file. The default value of the environment variable in a project created from the Blazor WebAssembly project template is `Development`. For more information, see the [Set the client-side environment via header](#set-the-client-side-environment-via-header) section. +:::moniker-end + For app's running locally in development, the app defaults to the `Development` environment. Publishing the app defaults the environment to `Production`. :::moniker range="< aspnetcore-5.0" @@ -111,10 +135,14 @@ Standalone Blazor WebAssembly: **In the preceding example, the `{BLAZOR SCRIPT}` placeholder is the Blazor script path and file name.** For the location of the script, see . +:::moniker range="< aspnetcore-10.0" + Using the `environment` property overrides the environment set by the [`Blazor-Environment` header](#set-the-client-side-environment-via-header). The preceding approach sets the client's environment without changing the `Blazor-Environment` header's value, nor does it change the server project's console logging of the startup environment for a Blazor Web App that has adopted global Interactive WebAssembly rendering. +:::moniker-end + To log the environment to the console in either a standalone Blazor WebAssembly app or the `.Client` project of a Blazor Web App, place the following C# code in the `Program` file after the is created with and before the line that builds and runs the project (`await builder.Build().RunAsync();`): ```csharp @@ -124,6 +152,8 @@ Console.WriteLine( For more information on Blazor startup, see . +:::moniker range="< aspnetcore-10.0" + ## Set the client-side environment via header Blazor WebAssembly apps can set the environment with the `Blazor-Environment` header. Specifically, the response header must be set on the `_framework/blazor.boot.json` file, but there's no harm setting the header on file server responses for other Blazor file requests or the entire Blazor deployment. @@ -191,7 +221,7 @@ For more information, see the following resources: * [Apache documentation (search the latest release for "`mod_headers`")](https://httpd.apache.org/docs/) * -## Set the environment for Azure App Service +### Set the environment for Azure App Service From b8198515316d1e6bf1a53987e424f46fa2cf8ffe Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Tue, 8 Apr 2025 07:56:21 -0400 Subject: [PATCH 5/6] Clarify automatic addition of the `multiple` attr (#35171) --- aspnetcore/blazor/forms/input-components.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/blazor/forms/input-components.md b/aspnetcore/blazor/forms/input-components.md index abfbeb679531..6fd060eaf8ba 100644 --- a/aspnetcore/blazor/forms/input-components.md +++ b/aspnetcore/blazor/forms/input-components.md @@ -327,7 +327,7 @@ In the following example: ## Multiple option selection with the `InputSelect` component -Binding supports [`multiple`](https://developer.mozilla.org/docs/Web/HTML/Attributes/multiple) option selection with the component. The [`@onchange`](xref:mvc/views/razor#onevent) event provides an array of the selected options via [event arguments (`ChangeEventArgs`)](xref:blazor/components/event-handling#event-arguments). The value must be bound to an array type, and binding to an array type makes the [`multiple`](https://developer.mozilla.org/docs/Web/HTML/Attributes/multiple) attribute optional on the tag. +Binding supports [`multiple`](https://developer.mozilla.org/docs/Web/HTML/Attributes/multiple) option selection with the component. The [`@onchange`](xref:mvc/views/razor#onevent) event provides an array of the selected options via [event arguments (`ChangeEventArgs`)](xref:blazor/components/event-handling#event-arguments). The value must be bound to an array type, which results in the component automatically adding the [`multiple` attribute](https://developer.mozilla.org/docs/Web/HTML/Attributes/multiple) to the `