Configuration Test Page

This page demonstrates reading values from appsettings.json using IConfiguration

cloud
Current Environment: Production
Configuration loaded from appsettings.json
App Settings
Setting Value Code
Application Name DemsToday24 Shepherd Config["AppSettings:ApplicationName"]
Max Upload Size 10485760 bytes Config.GetValue<int>("AppSettings:MaxUploadSize")
Enable Feature X True Config.GetValue<bool>("AppSettings:EnableFeatureX")
API Base URL https://api.example.com Config["AppSettings:ApiBaseUrl"]
Default Calendar View month Config["AppSettings:DefaultCalendarView"]
Other Examples
Connection String:

Config.GetConnectionString("SymDbConnection")

Result: Data Source=SQL5111.site4now.net;Initial Catalog=d...

With Default Value:

Config.GetValue<string>("AppSettings:NonExistent", "default value")

Result: This is the default value!

Quick Reference:
  • String: Config["Section:Key"] or Config.GetValue<string>("Section:Key")
  • Int/Bool: Config.GetValue<int>("Section:Key") or Config.GetValue<bool>("Section:Key")
  • With Default: Config.GetValue<T>("Section:Key", defaultValue)
  • Connection String: Config.GetConnectionString("ConnectionName")