Question

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.

Was it helpful?

Solution

Add a reference to System.Configuration.dll.

Here's an explanation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top