Thursday, December 13, 2012

System.Configuration.ConfigurationSettings.AppSettings' is obsolete

Have you ever come across the warning

System.Configuration.ConfigurationSettings.AppSettings' is obsolete: '"This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings



Here is the way to fix it

Add a reference to System.Configuration









































Select System.Configuration from .Net Tab as shown below


Add the references on your page as follows

using System.Configuration(C#)
Imports System.Configuration(in VB.NET)



Then use ConfigurationManager.AppSettings["yourconnectionstring"] to access the settings instead of 
System.Configuration.ConfigurationSettings.AppSettings["yourconnectionstring"]


Warning will be gone when you rebuild the solution.

Happy coding cheers 


No comments:

Post a Comment

Popular Posts