PowerShellRazorPage.UsePowerShellRazorPages method
Enables .cshtml
+ .cshtml.ps1
pairs. For a request to /Foo
it will, in order:
- Look for
Pages/Foo.cshtml
- If a
Pages/Foo.cshtml.ps1
exists, execute it in the supplied runspace-pool - Whatever the script assigns to
$Model
is copied toHttpContext.Items["PageModel"]
Razor pages (or a generic PwshKestrunModel
) can then read that dynamic object.
public static IApplicationBuilder UsePowerShellRazorPages(this IApplicationBuilder app,
KestrunRunspacePoolManager pool)
parameter | description |
---|---|
app | The WebApplication pipeline. |
pool | Kestrun’s shared KestrunRunspacePoolManager . |
Return Value
app for fluent chaining.
See Also
- class KestrunRunspacePoolManager
- class PowerShellRazorPage
- namespace Kestrun.Razor