I am going through some E-Commerce exercises in .NET 1.1. 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
.NET 1.1
Public Class Catalog
Private Shared ReadOnly Property connectionstring() as String
in the 1.1 framework, the web.config file did not have a dedicated section for connection strings. so connectionstrings were often stored in the appSettings section.
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.
Mike Banavige
Marked as answer by mbanavige on Jan 01, 2010 03:08 AM
Robbied81
Member
71 Points
138 Posts
ConfigurationSettings.AppSettings obsolete
Dec 12, 2009 10:31 PM|LINK
I am going through some E-Commerce exercises in .NET 1.1. 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
.NET 1.1
Public Class Catalog
Private Shared ReadOnly Property connectionstring() as String
Get
Return ConfigurationSettings.AppSettings("ConnectionString")
End Get
End Property
End Class
.NET 2.0
Imports System.Configuration.ConfigurationManager
Public Class Catalog
Private Shared ReadOnly Property connectionString() As String
Get
Return ConnectionStrings("ConnectionString").ConnectionString
End Get
End Property
End Class
Regards
Rob
mbanavige
All-Star
134980 Points
15429 Posts
ASPInsiders
Moderator
MVP
Re: ConfigurationSettings.AppSettings obsolete
Dec 13, 2009 02:11 AM|LINK
your 2 code samples are not entirely equivalent.
in the 1.1 framework, the web.config file did not have a dedicated section for connection strings. so connectionstrings were often stored in the appSettings section.
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.