79298106

Date: 2024-12-20 18:33:01
Score: 1
Natty:
Report link

I mean, you can do whatever you like, basically? Here’s an example that just displays the title of the current Hosting Environment by injecting IWebHostEnvironment right into the Razor page:

@page
@model MyApp.IndexModel
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment Env

<h1>@Env.EnvironmentName</h1>

That’s pretty much how it’s done in this sample from the docs: https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/environments/samples/6.x/EnvironmentsSample/Pages/About.cshtml

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
Posted by: BenderBoy