Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using appsettings, but "ConfigurationSettings" method is obsolete

I've trying to access an appsettings key value in my vb.net 2.0 web application.

I've put the key in the app.config file:

<appSettings>
    <add key="DownloadURL" value="http://<myURL>/" />
</appSettings>

I've followed the instructions here, and it says that I need to access this key like so:

URL = System.Configuration.ConfigurationSettings.AppSettings("DownloadURL")

But I get the following message:

Public Shared Readonly property AppSettings() As 'System.Collections.Specialized.NameValueCollection' is obsolete: 'This method is obsolete, it has been replaced by System.configuration!System.configuration.configurationmanager.AppSettings'

I tried to replace the old method with the new one, but it does not exist.

Strange, since I've done a similar thing with a web app and it did exist there.

like image 210
Urbycoz Avatar asked Jan 20 '23 11:01

Urbycoz


1 Answers

Add a reference to System.Configuration.dll.

Here's an explanation.

like image 123
Gerrie Schenck Avatar answered Jan 22 '23 02:01

Gerrie Schenck