Merge pull request #34413 from dotnet/main
commit
e009bab317
|
@ -17,23 +17,9 @@ jobs:
|
|||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: `### 🍂🎁 **_Happy Holidays!_** ❄️⛄
|
||||
body: `### 💃🕺🥳 **_Happy New Year!_** 🎈🎆🍾🥂🎉
|
||||
|
||||
This issue has been marked for triage on the Blazor Hybrid Docs GitHub project, and we'll respond as soon as we return from the holiday vacation after New Year's.
|
||||
|
||||
We only work on documentation on this repo. If you need product support, close this issue and seek assistance through one or more of the following support channels:
|
||||
|
||||
* [Stack Overflow (tagged: 'blazor')](https://stackoverflow.com/questions/tagged/blazor)
|
||||
* [General ASP.NET Core Slack Team](https://aspnetcore.slack.com/join/shared_invite/zt-1mv5487zb-EOZxJ1iqb0A0ajowEbxByQ#/shared-invite/email)
|
||||
* [Blazor Gitter](https://gitter.im/aspnet/Blazor)
|
||||
|
||||
If you think that you found a potential bug in the framework or have product feedback, close this issue and open a new issue for the ASP.NET Core product unit at [dotnet/aspnetcore issues](https://github.com/dotnet/aspnetcore/issues). Bug reports require a clear explanation of the problem, usually including a minimal repro project placed on GitHub for the product unit engineers to download and run. If you determine with the product unit that it isn't a bug but merely requires documentation, please re-open this docs issue and place a cross-link to your engineering issue discussion.
|
||||
|
||||
For problems or feedback on Visual Studio, close this issue and use the [**Report a Problem**](https://docs.microsoft.com/visualstudio/ide/how-to-report-a-problem-with-visual-studio) or [**Suggest a Feature**](https://docs.microsoft.com/visualstudio/ide/suggest-a-feature) processes from within VS, which open internal issues for the VS product unit. For more information, see [Visual Studio Feedback](https://developercommunity.visualstudio.com/home).
|
||||
|
||||
For problems with Visual Studio Code, close this issue and ask for support on community support forums. For bug reports and product feedback, open an issue on the [microsoft/vscode GitHub repo](https://github.com/microsoft/vscode/issues).
|
||||
|
||||
💃🕺🥳 **_Happy New Year!_** 🎈🎆🍾🥂🎉 **_See you in 2025!_**`
|
||||
A green dinosaur 🦖 will be along shortly to assist. *Stand-by ........*`
|
||||
})
|
||||
await github.rest.issues.addLabels({
|
||||
issue_number: context.issue.number,
|
||||
|
|
|
@ -22,23 +22,9 @@ jobs:
|
|||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: `### 🍂🎁 **_Happy Holidays!_** ❄️⛄
|
||||
body: `### 💃🕺🥳 **_Happy New Year!_** 🎈🎆🍾🥂🎉
|
||||
|
||||
This issue has been marked for triage on the Blazor Docs GitHub project, and I'll respond as soon as I return from the holiday vacation after New Year's.
|
||||
|
||||
We only work on documentation on this repo. If you need product support, close this issue and seek assistance through one or more of the following support channels:
|
||||
|
||||
* [Stack Overflow (tagged: 'blazor')](https://stackoverflow.com/questions/tagged/blazor)
|
||||
* [General ASP.NET Core Slack Team](https://aspnetcore.slack.com/join/shared_invite/zt-1mv5487zb-EOZxJ1iqb0A0ajowEbxByQ#/shared-invite/email)
|
||||
* [Blazor Gitter](https://gitter.im/aspnet/Blazor)
|
||||
|
||||
If you think that you found a potential bug in the framework or have product feedback, close this issue and open a new issue for the ASP.NET Core product unit at [dotnet/aspnetcore issues](https://github.com/dotnet/aspnetcore/issues). Bug reports require a clear explanation of the problem, usually including a minimal repro project placed on GitHub for the product unit engineers to download and run. If you determine with the product unit that it isn't a bug but merely requires documentation, please re-open this docs issue and place a cross-link to your engineering issue discussion.
|
||||
|
||||
For problems or feedback on Visual Studio, close this issue and use the [**Report a Problem**](https://docs.microsoft.com/visualstudio/ide/how-to-report-a-problem-with-visual-studio) or [**Suggest a Feature**](https://docs.microsoft.com/visualstudio/ide/suggest-a-feature) processes from within VS, which open internal issues for the VS product unit. For more information, see [Visual Studio Feedback](https://developercommunity.visualstudio.com/home).
|
||||
|
||||
For problems with Visual Studio Code, close this issue and ask for support on community support forums. For bug reports and product feedback, open an issue on the [microsoft/vscode GitHub repo](https://github.com/microsoft/vscode/issues).
|
||||
|
||||
💃🕺🥳 **_Happy New Year!_** 🎈🎆🍾🥂🎉 **_See you in 2025!_**`
|
||||
*Stand-by!* ... A green dinosaur 🦖 will be along shortly to assist.`
|
||||
})
|
||||
await github.rest.issues.addLabels({
|
||||
issue_number: context.issue.number,
|
||||
|
|
|
@ -114,13 +114,13 @@ A form is defined using the Blazor framework's <xref:Microsoft.AspNetCore.Compon
|
|||
|
||||
In the preceding `Starship1` component:
|
||||
|
||||
* The <xref:Microsoft.AspNetCore.Components.Forms.EditForm> component is rendered where the `<EditForm>` element appears. The form is named with the [`@formname`](xref:mvc/views/razor#formname) directive attribute, which uniquely identifies the form to the Blazor framework.
|
||||
* The <xref:Microsoft.AspNetCore.Components.Forms.EditForm> component is rendered where the `<EditForm>` element appears. The form is named with the <xref:Microsoft.AspNetCore.Components.Forms.EditForm.FormName> property, which uniquely identifies the form to the Blazor framework.
|
||||
* The model is created in the component's `@code` block and held in a public property (`Model`). The property is assigned to the <xref:Microsoft.AspNetCore.Components.Forms.EditForm.Model?displayProperty=nameWithType> parameter. The `[SupplyParameterFromForm]` attribute indicates that the value of the associated property should be supplied from the form data. Data in the request that matches the property's name is bound to the property.
|
||||
* The <xref:Microsoft.AspNetCore.Components.Forms.InputText> component is an [input component](xref:blazor/forms/input-components) for editing string values. The `@bind-Value` directive attribute binds the `Model.Id` model property to the <xref:Microsoft.AspNetCore.Components.Forms.InputText> component's <xref:Microsoft.AspNetCore.Components.Forms.InputBase%601.Value%2A> property.
|
||||
* The `Submit` method is registered as a handler for the <xref:Microsoft.AspNetCore.Components.Forms.EditForm.OnSubmit> callback. The handler is called when the form is submitted by the user.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Always use the [`@formname`](xref:mvc/views/razor#formname) directive attribute with a unique form name.
|
||||
> Always use the <xref:Microsoft.AspNetCore.Components.Forms.EditForm.FormName> property with a unique form name.
|
||||
|
||||
Blazor enhances page navigation and form handling for <xref:Microsoft.AspNetCore.Components.Forms.EditForm> components. For more information, see <xref:blazor/fundamentals/routing#enhanced-navigation-and-form-handling>.
|
||||
|
||||
|
|
|
@ -276,9 +276,6 @@ For information on ordering the Localization Middleware in the middleware pipeli
|
|||
|
||||
Use the `CultureExample1` component shown in the [Demonstration component](#demonstration-component) section to study how globalization works. Issue a request with United States English (`en-US`). Switch to Costa Rican Spanish (`es-CR`) in the browser's language settings. Request the webpage again.
|
||||
|
||||
> [!NOTE]
|
||||
> Some browsers force you to use the default language setting for both requests and the browser's own UI settings. This can make changing the language back to one that you understand difficult because all of the setting UI screens might end up in a language that you can't read. A browser such as [Opera](https://www.opera.com/download) is a good choice for testing because it permits you to set a default language for webpage requests but leave the browser's settings UI in your language.
|
||||
|
||||
When the culture is United States English (`en-US`), the rendered component uses month/day date formatting (`6/7`), 12-hour time (`AM`/`PM`), and comma separators in numbers with a dot for the decimal value (`1,999.69`):
|
||||
|
||||
* **Date**: 6/7/2021 6:45:22 AM
|
||||
|
|
|
@ -50,8 +50,18 @@ In a traditional server-rendered app, opening the same app in multiple browser s
|
|||
|
||||
![The browser interacts with Blazor (hosted inside of an ASP.NET Core app) on the server over a SignalR connection.](~/blazor/hosting-models/_static/blazor-server.png)
|
||||
|
||||
:::moniker range=">= aspnetcore-10.0"
|
||||
|
||||
On the client, the Blazor script establishes the SignalR connection with the server. The script is served as a static web asset with automatic compression and [fingerprinting](https://developer.mozilla.org/docs/Glossary/Fingerprinting).
|
||||
|
||||
:::moniker-end
|
||||
|
||||
:::moniker range="< aspnetcore-10.0"
|
||||
|
||||
On the client, the Blazor script establishes the SignalR connection with the server. The script is served from an embedded resource in the ASP.NET Core shared framework.
|
||||
|
||||
:::moniker-end
|
||||
|
||||
The Blazor Server hosting model offers several benefits:
|
||||
|
||||
* Download size is significantly smaller than when the Blazor WebAssembly hosting model is used, and the app loads much faster.
|
||||
|
@ -97,8 +107,8 @@ A Blazor WebAssembly app built as a [Progressive Web App (PWA)](xref:blazor/prog
|
|||
|
||||
The Blazor script handles:
|
||||
|
||||
* Downloading the .NET runtime, Razor components, and the component's dependencies.
|
||||
* Initialization of the runtime.
|
||||
* Downloading the .NET runtime, Razor components, and dependencies.
|
||||
* Runtime initialization.
|
||||
|
||||
The size of the published app, its *payload size*, is a critical performance factor for an app's usability. A large app takes a relatively long time to download to a browser, which diminishes the user experience. Blazor WebAssembly optimizes payload size to reduce download times:
|
||||
|
||||
|
|
|
@ -152,6 +152,9 @@ export function showPrompt2(message) {
|
|||
}
|
||||
```
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Don't place a `<script>` tag for `JsCollocation2.razor.js` after the [Blazor script](xref:blazor/project-structure#location-of-the-blazor-script) because the module is loaded and cached automatically when the [dynamic `import()`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/import) is invoked.
|
||||
|
||||
Use of scripts and modules for collocated JS in a Razor class library (RCL) is only supported for Blazor's JS interop mechanism based on the <xref:Microsoft.JSInterop.IJSRuntime> interface. If you're implementing [JavaScript `[JSImport]`/`[JSExport]` interop](xref:blazor/js-interop/import-export-interop), see <xref:blazor/js-interop/import-export-interop#razor-class-library-rcl-collocated-js-is-unsupported>.
|
||||
|
||||
For scripts or modules provided by a Razor class library (RCL) using <xref:Microsoft.JSInterop.IJSRuntime>-based JS interop, the following path is used:
|
||||
|
|
|
@ -623,6 +623,7 @@ In the preceding example:
|
|||
* The path segment for the current directory (`./`) is required in order to create the correct static asset path to the JS file.
|
||||
* The `{SCRIPT PATH AND FILE NAME (.js)}` placeholder is the path and file name under `wwwroot`.
|
||||
* Disposes the <xref:Microsoft.JSInterop.IJSObjectReference> for [garbage collection](xref:blazor/components/lifecycle#asynchronous-iasyncdisposable) in <xref:System.IAsyncDisposable.DisposeAsync%2A?displayProperty=nameWithType>.
|
||||
* Don't place a `<script>` tag for the script after the [Blazor script](xref:blazor/project-structure#location-of-the-blazor-script) because the module is loaded and cached automatically when the [dynamic `import()`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/import) is invoked.
|
||||
|
||||
Dynamically importing a module requires a network request, so it can only be achieved asynchronously by calling <xref:Microsoft.JSInterop.IJSRuntime.InvokeAsync%2A>.
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ Load JavaScript (JS) code using any of the following approaches:
|
|||
|
||||
:::moniker-end
|
||||
|
||||
Inline JavaScript isn't recommended for Blazor apps. We recommend using [JS collocation](#load-a-script-from-an-external-javascript-file-js-collocated-with-a-component) combined with [JS modules](#javascript-isolation-in-javascript-modules).
|
||||
|
||||
## Location of `<script>` tags
|
||||
|
||||
:::moniker range=">= aspnetcore-8.0"
|
||||
|
|
|
@ -536,8 +536,18 @@ The project structure of the client-side app in a hosted Blazor Webassembly solu
|
|||
|
||||
## Location of the Blazor script
|
||||
|
||||
:::moniker range=">= aspnetcore-10.0"
|
||||
|
||||
The Blazor script is served as a static web asset with automatic compression and fingerprinting. For more information, see <xref:blazor/fundamentals/static-files>.
|
||||
|
||||
:::moniker-end
|
||||
|
||||
:::moniker range="< aspnetcore-10.0"
|
||||
|
||||
The Blazor script is served from an embedded resource in the ASP.NET Core shared framework.
|
||||
|
||||
:::moniker-end
|
||||
|
||||
:::moniker range=">= aspnetcore-8.0"
|
||||
|
||||
In a Blazor Web App, the Blazor script is located in the `Components/App.razor` file:
|
||||
|
|
|
@ -31,19 +31,19 @@ Minimally, specify the following directives and sources for Blazor apps. Add add
|
|||
|
||||
:::moniker range=">= aspnetcore-8.0"
|
||||
|
||||
* [base-uri](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/base-uri): Restricts the URLs for a page's `<base>` tag. Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* [default-src](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/default-src): Indicates a fallback for source directives that aren't explicitly specified by the policy. Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* [img-src](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/img-src): Indicates valid sources for images.
|
||||
* [`base-uri`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/base-uri): Restricts the URLs for a page's `<base>` tag. Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* [`default-src`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/default-src): Indicates a fallback for source directives that aren't explicitly specified by the policy. Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* [`img-src`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/img-src): Indicates valid sources for images.
|
||||
* Specify `data:` to permit loading images from `data:` URLs.
|
||||
* Specify `https:` to permit loading images from HTTPS endpoints.
|
||||
* [object-src](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/object-src): Indicates valid sources for the `<object>`, `<embed>`, and `<applet>` tags. Specify `none` to prevent all URL sources.
|
||||
* [script-src](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/script-src): Indicates valid sources for scripts.
|
||||
* [`object-src`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/object-src): Indicates valid sources for the `<object>`, `<embed>`, and `<applet>` tags. Specify `none` to prevent all URL sources.
|
||||
* [`script-src`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/script-src): Indicates valid sources for scripts.
|
||||
* Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* In a client-side Blazor app:
|
||||
* Specify [`wasm-unsafe-eval`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/script-src#unsafe_webassembly_execution) to permit the client-side Blazor Mono runtime to function.
|
||||
* Specify any additional hashes to permit your required *non-framework scripts* to load.
|
||||
* In a server-side Blazor app, specify hashes to permit required scripts to load.
|
||||
* [style-src](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/style-src): Indicates valid sources for stylesheets.
|
||||
* [`style-src`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/style-src): Indicates valid sources for stylesheets.
|
||||
* Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* If the app uses inline styles, specify `unsafe-inline` to allow the use of your inline styles.
|
||||
* [upgrade-insecure-requests](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/upgrade-insecure-requests): Indicates that content URLs from insecure (HTTP) sources should be acquired securely over HTTPS.
|
||||
|
@ -52,68 +52,68 @@ Minimally, specify the following directives and sources for Blazor apps. Add add
|
|||
|
||||
:::moniker range=">= aspnetcore-7.0 < aspnetcore-8.0"
|
||||
|
||||
* [base-uri](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/base-uri): Restricts the URLs for a page's `<base>` tag. Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* [default-src](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/default-src): Indicates a fallback for source directives that aren't explicitly specified by the policy. Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* [img-src](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/img-src): Indicates valid sources for images.
|
||||
* [`base-uri`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/base-uri): Restricts the URLs for a page's `<base>` tag. Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* [`default-src`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/default-src): Indicates a fallback for source directives that aren't explicitly specified by the policy. Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* [`img-src`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/img-src): Indicates valid sources for images.
|
||||
* Specify `data:` to permit loading images from `data:` URLs.
|
||||
* Specify `https:` to permit loading images from HTTPS endpoints.
|
||||
* [object-src](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/object-src): Indicates valid sources for the `<object>`, `<embed>`, and `<applet>` tags. Specify `none` to prevent all URL sources.
|
||||
* [script-src](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/script-src): Indicates valid sources for scripts.
|
||||
* [`object-src`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/object-src): Indicates valid sources for the `<object>`, `<embed>`, and `<applet>` tags. Specify `none` to prevent all URL sources.
|
||||
* [`script-src`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/script-src): Indicates valid sources for scripts.
|
||||
* Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* In a client-side Blazor app:
|
||||
* Specify `unsafe-eval` to permit the client-side Blazor Mono runtime to function.
|
||||
* Specify any additional hashes to permit your required *non-framework scripts* to load.
|
||||
* In a server-side Blazor app, specify hashes to permit required scripts to load.
|
||||
* [style-src](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/style-src): Indicates valid sources for stylesheets.
|
||||
* [`style-src`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/style-src): Indicates valid sources for stylesheets.
|
||||
* Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* If the app uses inline styles, specify `unsafe-inline` to allow the use of your inline styles.
|
||||
* [upgrade-insecure-requests](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/upgrade-insecure-requests): Indicates that content URLs from insecure (HTTP) sources should be acquired securely over HTTPS.
|
||||
* [`upgrade-insecure-requests`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/upgrade-insecure-requests): Indicates that content URLs from insecure (HTTP) sources should be acquired securely over HTTPS.
|
||||
|
||||
:::moniker-end
|
||||
|
||||
:::moniker range=">= aspnetcore-6.0 < aspnetcore-7.0"
|
||||
|
||||
* [base-uri](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/base-uri): Restricts the URLs for a page's `<base>` tag. Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* [default-src](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/default-src): Indicates a fallback for source directives that aren't explicitly specified by the policy. Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* [img-src](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/img-src): Indicates valid sources for images.
|
||||
* [`base-uri`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/base-uri): Restricts the URLs for a page's `<base>` tag. Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* [`default-src`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/default-src): Indicates a fallback for source directives that aren't explicitly specified by the policy. Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* [`img-src`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/img-src): Indicates valid sources for images.
|
||||
* Specify `data:` to permit loading images from `data:` URLs.
|
||||
* Specify `https:` to permit loading images from HTTPS endpoints.
|
||||
* [object-src](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/object-src): Indicates valid sources for the `<object>`, `<embed>`, and `<applet>` tags. Specify `none` to prevent all URL sources.
|
||||
* [script-src](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/script-src): Indicates valid sources for scripts.
|
||||
* [`object-src`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/object-src): Indicates valid sources for the `<object>`, `<embed>`, and `<applet>` tags. Specify `none` to prevent all URL sources.
|
||||
* [`script-src`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/script-src): Indicates valid sources for scripts.
|
||||
* Specify the `https://stackpath.bootstrapcdn.com/` host source for Bootstrap scripts.
|
||||
* Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* In a client-side Blazor app:
|
||||
* Specify `unsafe-eval` to permit the client-side Blazor Mono runtime to function.
|
||||
* Specify any additional hashes to permit your required *non-framework scripts* to load.
|
||||
* In a server-side Blazor app, specify hashes to permit required scripts to load.
|
||||
* [style-src](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/style-src): Indicates valid sources for stylesheets.
|
||||
* [`style-src`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/style-src): Indicates valid sources for stylesheets.
|
||||
* Specify the `https://stackpath.bootstrapcdn.com/` host source for Bootstrap stylesheets.
|
||||
* Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* Specify `unsafe-inline` to allow the use of inline styles.
|
||||
* [upgrade-insecure-requests](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/upgrade-insecure-requests): Indicates that content URLs from insecure (HTTP) sources should be acquired securely over HTTPS.
|
||||
* [`upgrade-insecure-requests`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/upgrade-insecure-requests): Indicates that content URLs from insecure (HTTP) sources should be acquired securely over HTTPS.
|
||||
|
||||
:::moniker-end
|
||||
|
||||
:::moniker range="< aspnetcore-6.0"
|
||||
|
||||
* [base-uri](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/base-uri): Restricts the URLs for a page's `<base>` tag. Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* [default-src](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/default-src): Indicates a fallback for source directives that aren't explicitly specified by the policy. Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* [img-src](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/img-src): Indicates valid sources for images.
|
||||
* [`base-uri`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/base-uri): Restricts the URLs for a page's `<base>` tag. Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* [`default-src`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/default-src): Indicates a fallback for source directives that aren't explicitly specified by the policy. Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* [`img-src`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/img-src): Indicates valid sources for images.
|
||||
* Specify `data:` to permit loading images from `data:` URLs.
|
||||
* Specify `https:` to permit loading images from HTTPS endpoints.
|
||||
* [object-src](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/object-src): Indicates valid sources for the `<object>`, `<embed>`, and `<applet>` tags. Specify `none` to prevent all URL sources.
|
||||
* [script-src](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/script-src): Indicates valid sources for scripts.
|
||||
* [`object-src`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/object-src): Indicates valid sources for the `<object>`, `<embed>`, and `<applet>` tags. Specify `none` to prevent all URL sources.
|
||||
* [`script-src`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/script-src): Indicates valid sources for scripts.
|
||||
* Specify the `https://stackpath.bootstrapcdn.com/` host source for Bootstrap scripts.
|
||||
* Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* In a client-side Blazor app:
|
||||
* Specify hashes to permit required scripts to load.
|
||||
* Specify `unsafe-eval` to use `eval()` and methods for creating code from strings.
|
||||
* In a server-side Blazor app, specify hashes to permit required scripts to load.
|
||||
* [style-src](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/style-src): Indicates valid sources for stylesheets.
|
||||
* [`style-src`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/style-src): Indicates valid sources for stylesheets.
|
||||
* Specify the `https://stackpath.bootstrapcdn.com/` host source for Bootstrap stylesheets.
|
||||
* Specify `self` to indicate that the app's origin, including the scheme and port number, is a valid source.
|
||||
* Specify `unsafe-inline` to allow the use of inline styles. The inline declaration is required for the UI for reconnecting the client and server after the initial request. In a future release, inline styling might be removed so that `unsafe-inline` is no longer required.
|
||||
* [upgrade-insecure-requests](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/upgrade-insecure-requests): Indicates that content URLs from insecure (HTTP) sources should be acquired securely over HTTPS.
|
||||
* [`upgrade-insecure-requests`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/upgrade-insecure-requests): Indicates that content URLs from insecure (HTTP) sources should be acquired securely over HTTPS.
|
||||
|
||||
:::moniker-end
|
||||
|
||||
|
@ -199,6 +199,8 @@ Add additional `script-src` and `style-src` hashes as required by the app. Durin
|
|||
|
||||
The particular script associated with the error is displayed in the console next to the error.
|
||||
|
||||
For guidance on applying a CSP to an app in C# code at startup, see <xref:blazor/fundamentals/startup#control-headers-in-c-code>.
|
||||
|
||||
### Client-side Blazor apps
|
||||
|
||||
In the [`<head>` content](xref:blazor/project-structure#location-of-head-and-body-content), apply the directives described in the *Policy directives* section:
|
||||
|
|
|
@ -19,7 +19,7 @@ else
|
|||
<tr>
|
||||
<th>Date</th>
|
||||
<th aria-label="Temperature in Celsius">Temp. (C)</th>
|
||||
<th aria-label="Temperature in Farenheit">Temp. (F)</th>
|
||||
<th aria-label="Temperature in Fahrenheit">Temp. (F)</th>
|
||||
<th>Summary</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
|
@ -262,7 +262,7 @@ The following table shows the requests and responses from `http://localhost:1234
|
|||
| `localhost:1234` | `Hello from non-Map delegate.` |
|
||||
| `localhost:1234/?branch=main` | `Branch used = main` |
|
||||
|
||||
<xref:Microsoft.AspNetCore.Builder.UseWhenExtensions.UseWhen%2A> also branches the request pipeline based on the result of the given predicate. Unlike with `MapWhen`, this branch is rejoined to the main pipeline if it doesn't short-circuit or contain a terminal middleware:
|
||||
<xref:Microsoft.AspNetCore.Builder.UseWhenExtensions.UseWhen%2A> also branches the request pipeline based on the result of the given predicate. Unlike with `MapWhen`, this branch is rejoined to the main pipeline if it doesn't contain a terminal middleware:
|
||||
|
||||
[!code-csharp[](~/fundamentals/middleware/index/snapshot/Chain60/ProgramUseWhen.cs?highlight=4-5)]
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ monikerRange: '>= aspnetcore-6.0'
|
|||
ms.date: 8/02/2024
|
||||
uid: fundamentals/openapi/overview
|
||||
---
|
||||
|
||||
# OpenAPI support in ASP.NET Core API apps
|
||||
|
||||
[!INCLUDE[](~/includes/not-latest-version.md)]
|
||||
|
|
|
@ -21,7 +21,7 @@ else
|
|||
<tr>
|
||||
<th>Date</th>
|
||||
<th aria-label="Temperature in Celsius">Temp. (C)</th>
|
||||
<th aria-label="Temperature in Farenheit">Temp. (F)</th>
|
||||
<th aria-label="Temperature in Fahrenheit">Temp. (F)</th>
|
||||
<th>Summary</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
title: Identity model customization in ASP.NET Core
|
||||
author: ajcvickers
|
||||
description: This article describes how to customize the underlying Entity Framework Core data model for ASP.NET Core Identity.
|
||||
ms.author: avickers
|
||||
ms.author: riande
|
||||
ms.date: 10/29/2024
|
||||
uid: security/authentication/customize_identity_model
|
||||
---
|
||||
|
|
|
@ -180,7 +180,7 @@ The following code enables various [Middleware](xref:fundamentals/middleware/ind
|
|||
* `app.UseRouting();` : Adds route matching to the middleware pipeline. For more information, see <xref:fundamentals/routing>.
|
||||
* `app.UseAuthorization();` : Authorizes a user to access secure resources. This app doesn't use authorization, therefore this line could be removed.
|
||||
* `app.MapRazorPages();`: Configures endpoint routing for Razor Pages.
|
||||
* `app.MapStaticAssets();` : Optimize the delivery of static assets in an app such as such as HTML, CSS, images, and JavaScript to be served. For more information, see <xref:aspnetcore-9#optimizing-static-web-asset-delivery>.
|
||||
* `app.MapStaticAssets();` : Optimize the delivery of static assets in an app, such as HTML, CSS, images, and JavaScript. For more information, see <xref:aspnetcore-9#optimizing-static-web-asset-delivery>.
|
||||
* `app.Run();` : Runs the app.
|
||||
|
||||
## Troubleshooting with the completed sample
|
||||
|
|
Loading…
Reference in New Issue