Go4Expert

Go4Expert (http://www.go4expert.com/)
-   ASP (http://www.go4expert.com/forums/asp/)
-   -   where to insert <appSettings... > tag in web.config file (http://www.go4expert.com/forums/insert-appsettings-tag-webconfig-file-t19946/)

shyam_oec 2Nov2009 06:19

where to insert <appSettings... > tag in web.config file
 
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.

nimesh 2Nov2009 12:23

Re: where to insert <appSettings... > tag in web.config file
 
<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>


urstop 4Nov2009 16:11

Re: where to insert <appSettings... > tag in web.config file
 
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>


All times are GMT +5.5. The time now is 10:12.