I have this in my "appsettings.json"
"AllowedHosts": "*",
"AlprReport": {
"ConnectionAddress": "http://192.168.100.37:81/alprreport/cashdeclaration"
}
I tried getting it in my Razor as so:
public RazorComponent : ComponentBase
{
[Inject] IConfiguration configuration;
public void SomeMethod()
{
var result = configuration.GetSection("AlprReport:ConnectionAddress").Value
}
}
I always get null value on result. I tried getting it from my "Program.cs" using this:
var alprReport = builder.Configuration.GetSection("AlprReport:ConnectionAddress").Value;
Still I cannot get it to work. What am I doing wrong here? Thanks.