Welcome to AspAdvice Sign in | Join | Help

3 Benefits of Using ConnectionStrings Instead of AppSettings

With .NET 1.0, we are using .AppSettings In .NET 1.0 we used ConfigurationSettings instead of ConfigurationManager

Read the article on SharpDeveloper.net
Sponsor
Published Tuesday, May 15, 2007 2:43 PM by salibhai
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Updating ConfigurationManager.AppSettings to ConfigurationManager.ConnectionStrings

Wednesday, May 16, 2007 4:54 PM by Brendan
Actually that is not the .NET 1.x way of getting the connection string from AppSettings. ConfigurationManager did not exist until ASP.NET 2.0 It is a replacement for the deprecated ConfigurationSettings class It used to be this SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);

# re: Updating ConfigurationManager.AppSettings to ConfigurationManager.ConnectionStrings

Wednesday, May 16, 2007 5:13 PM by salibhai

Actually you are correct.

http://msdn2.microsoft.com/en-us/library/bf7sd233.aspx

So, along with the change to start using ConfigurationManager, one should make the above change as well, which will allow encrypting of connection strings, sqlCacheDependency, etc..

See http://msdn2.microsoft.com/en-us/library/bf7sd233.aspx for more details.

Leave a Comment

(required) 
required 
(required) 
Enter the code you see below