You can use the <appSettings> element to store a database connection string in the custom settings section of an application configuration file. This element supports arbitrary key-value pairs, as illustrated in the following fragment:

<configuration>
 <appSettings>
  <add key="Shashi"
     value="server=(local);Integrated Security=SSPI;database=Nic"/>
 </appSettings>
</configuration>
  

Note The <appSettings> element appears under the <configuration> element and not directly under <system.web>.


Advantages

Disadvantages

More Information