web.config
<configuration>
<appSettings>
<add key="DBConnectionString" value="server=localhost;database=web;uid=sa; pwd="/>
</appSettings>
</configuration>
----------------------------------------------------------------------------------------------------------
xxx.aspx.cs
SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["DBConnectionString"]);