Merge pull request #9087 from aspnet/scottaddie/rp-partial-view
Add detail about serving partial views named with underscorespull/9100/head
commit
b2f79137f1
|
@ -38,7 +38,7 @@ Don't use a partial view where complex rendering logic or code execution is requ
|
|||
|
||||
## Declare partial views
|
||||
|
||||
::: moniker range=">= aspnetcore-2.1"
|
||||
::: moniker range=">= aspnetcore-2.0"
|
||||
|
||||
A partial view is a *.cshtml* markup file maintained within the *Views* folder (MVC) or *Pages* folder (Razor Pages).
|
||||
|
||||
|
@ -46,11 +46,13 @@ In ASP.NET Core MVC, a controller's <xref:Microsoft.AspNetCore.Mvc.ViewResult> i
|
|||
|
||||
Unlike MVC view or page rendering, a partial view doesn't run *_ViewStart.cshtml*. For more information on *_ViewStart.cshtml*, see <xref:mvc/views/layout>.
|
||||
|
||||
Partial view file names often begin with an underscore (`_`). This naming convention isn't required, but it helps to visually differentiate partial views from views and pages. When the file name starts with an underscore, Razor Pages doesn't process the markup file as a Razor Pages page, even when the file's markup includes the `@page` directive.
|
||||
Partial view file names often begin with an underscore (`_`). This naming convention isn't required, but it helps to visually differentiate partial views from views and pages.
|
||||
|
||||
Razor Pages doesn't serve as a page a partial view whose file name begins with an underscore. The inclusion of a `@page` directive in the partial view's markup doesn't change this behavior. Don't rely on this behavior as a means to secure a partial view.
|
||||
|
||||
::: moniker-end
|
||||
|
||||
::: moniker range="< aspnetcore-2.1"
|
||||
::: moniker range="< aspnetcore-2.0"
|
||||
|
||||
A partial view is a *.cshtml* markup file maintained within the *Views* folder.
|
||||
|
||||
|
|
Loading…
Reference in New Issue