Adding configuration file in a 3 tier architecture

1.Add a single app.config file in the UI Layer
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>

    <add key="Server1" value="10.250.1.32" />
    <add key=" Server 2" value="10.251.1.54" />
   
   </appSettings>
</configuration>

1.      Add the system.configuration dll refererence to the projetc where you want to access these values
using System.Configuration;
//access values using below code
String ipaddress= ConfigurationSettings.AppSettings.Get("MDT1");

1 comment: