Thursday, February 13, 2020

.Net Core Configuration

appsettings.josn

{
"Name":  "Shalvin",
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "AllowedHosts": "*"
}

index.cshtml

@inject Microsoft.Extensions.Configuration.IConfiguration Configuration
@{
    ViewData["Title"] = "Home Page";
}



<div>
    @Configuration["ComputerName"]
</div>

<div>@Configuration["Name"]</div>

No comments:

Post a Comment