How can I access IConfiguration
in an MVC View in ASP.NET Core 1.1?
Ex. _Layout.cshtml
<link href="@Configuration["MyConfigEntry"]/css/site.min.css>
The IConfiguration is an interface for . Net Core 2.0. The IConfiguration interface need to be injected as dependency in the Controller and then later used throughout the Controller. The IConfiguration interface is used to read Settings and Connection Strings from AppSettings.
In asp.net core , you can inject IConfiguration
implementation to your views and use that :)
@using Microsoft.Extensions.Configuration @inject IConfiguration Configuration <link rel="stylesheet" href="@Configuration["MyConfigEntry"]/css/site.min.css">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With