where to insert <appSettings... > tag in web.config file

Contributor
2Nov2009,06:19   #1
shyam_oec's Avatar
dear sir,
i am unable to short out a problem that i get when inserting this <appSettings....> code in web.config file.i think i am not placing it right place..so plz help


Code:
<appSettings>
    <add key="SQLCON" value="Data Source=.\sqlexpress;Initial Catalog=DB1;Integrated Security=True;Pooling=False"/>
  </appSettings>
after inserting this in web.config i am properly writing the SqlConnection statements in main .cs file.
Invasive contributor
2Nov2009,12:23   #2
nimesh's Avatar
<appSettings> would go directly under <configuration>
http://msdn.microsoft.com/en-us/libr...8VS.71%29.aspx

Code: xml
<configuration>
    <appSettings>
        <add key="Application Name" value="MyApplication" />
    </appSettings>
</configuration>
Contributor
4Nov2009,16:11   #3
urstop's Avatar
For connection strings you can use the
Quote:
<connectionStrings>
section instead of appsettings. It will be like
Quote:
<configuration>
<connectionStrings>
<add name="ConnectionString" connectionString="server=.;database=mydatabasename ;uid=userid;pwd=password; " providerName="System.Data.SqlClient"/>
</connectionStrings>
</configuration>