使用appsettings,但"ConfigurationSettings"方法已过时

Urb*_*coz 4 vb.net appsettings windows-applications

我试图在我的vb.net 2.0 Web应用程序中访问appsettings键值.

我把密钥放在app.config文件中:

<appSettings>
    <add key="DownloadURL" value="http://<myURL>/" />
</appSettings>
Run Code Online (Sandbox Code Playgroud)

我按照这里的说明操作,它说我需要像这样访问这个键:

URL = System.Configuration.ConfigurationSettings.AppSettings("DownloadURL")
Run Code Online (Sandbox Code Playgroud)

但我收到以下消息:

公共共享只读属性的AppSettings()作为"System.Collections.Specialized.NameValueCollection"已过时:"此方法已过时,它已取代System.configuration System.configuration.configurationmanager.AppSettings!"

我试图用新方法替换旧方法,但它不存在.

很奇怪,因为我用网络应用做了类似的事情,它确实存在.

Ger*_*nck 9

添加对System.Configuration.dll的引用.

这是一个解释.