Web.config File
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="keyname" value="Data Source=ipaddress;
Network Library=DBMSSOCN;
Connection Timeout=15;
Packet Size=4096;
Integrated Security=no;
Initial Catalog=databasename;
User ID=username;
password=password;
Encrypt=no;
Max Pool Size=50000;"/>
</appSettings>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
</configuration>
======================================================================
How to access Config File
using System.Configuration;
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["keyname"]);
con.Open();
No comments:
Post a Comment