ConfigurationSettings.AppSettings obsoletehttp://forums.asp.net/t/1503415.aspx/1?ConfigurationSettings+AppSettings+obsoleteSun, 13 Dec 2009 02:11:38 -050015034153562078http://forums.asp.net/p/1503415/3562078.aspx/1?ConfigurationSettings+AppSettings+obsoleteConfigurationSettings.AppSettings obsolete <p>I am going through some E-Commerce exercises in .NET 1.1.&nbsp; I just wanted to know if this code I have below is equivalent to the code in 1.1, as I was getting error messages regarding code being obsolete</p> <p><br> </p> <p><u>.NET 1.1</u></p> <p>Public Class Catalog</p> <p>&nbsp;&nbsp; Private Shared ReadOnly Property connectionstring() as String</p> <p>&nbsp;&nbsp;&nbsp;&nbsp; Get</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Return ConfigurationSettings.AppSettings(&quot;ConnectionString&quot;)</p> <p>&nbsp;&nbsp;&nbsp; End Get</p> <p>&nbsp;&nbsp; End Property</p> <p>End Class<br> </p> <p><u>.NET 2.0</u></p> <p>Imports System.Configuration.ConfigurationManager<br> <br> Public Class Catalog<br> <br> &nbsp;&nbsp;&nbsp; Private Shared ReadOnly Property connectionString() As String<br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Get<br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Return ConnectionStrings(&quot;ConnectionString&quot;).ConnectionString<br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Get<br> <br> &nbsp;&nbsp;&nbsp; End Property<br> End Class</p> <p><br> </p> <p>Regards</p> <p>Rob<br> </p> 2009-12-12T22:31:06-05:003562162http://forums.asp.net/p/1503415/3562162.aspx/1?Re+ConfigurationSettings+AppSettings+obsoleteRe: ConfigurationSettings.AppSettings obsolete <p>your&nbsp;2 code samples are not entirely equivalent.</p> <p>in the 1.1 framework, the web.config file did not have a dedicated section for connection strings.&nbsp; so connectionstrings were often stored in the appSettings&nbsp;section.</p> <p>with 2.0, a dedicated ConnectionStrings section was added. so the 2nd example will require that you move the connection string from appSettings section of the web.config file into the ConnectionStrings section.</p> 2009-12-13T02:11:38-05:00