I cannot seem to figure out how to read values from the appsettings.json in my _Layout.chtml file.
Is it not just available, something like this? @Configuration["ApplicationInsights:InstrumentationKey"]
I created a new MVC project using razor pages.
fyi, i'm an mvc newbee - code samples help a lot.
In .net core mvc you can inject the configuration by adding the following two lines at the top of your view:
@using Microsoft.Extensions.Configuration
@inject IConfiguration Configuration
You can then access the value like this:
@Configuration.GetSection("ApplicationInsights")["InstrumentationKey"]