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

shyam_oec's Avatar, Join Date: Nov 2007
Contributor
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.
0
nimesh's Avatar, Join Date: Apr 2009
Invasive contributor
<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>
0
urstop's Avatar, Join Date: Oct 2007
Contributor
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>