<configuration>
<add
name="KeyName"
connectionString="Data Source=ServerName;Initial Catalog=dbsample;Integrated
Security=True" />
public static string
GetConnectionStringFromWebConfigByName(string
name)
{
return WebConfigurationManager.ConnectionStrings[name].ConnectionString;