我试图在我的vb.net 2.0 Web应用程序中访问appsettings键值. 我把密钥放在app.config文件中: appSettings add key="DownloadURL" value="http://myURL/" //appSettings 我按照说明here,它说我需要像这样访问这个键
我把密钥放在app.config文件中:
<appSettings> <add key="DownloadURL" value="http://<myURL>/" /> </appSettings>
我按照说明here,它说我需要像这样访问这个键:
URL = System.Configuration.ConfigurationSettings.AppSettings("DownloadURL")
但我收到以下消息:
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’
我试图用新方法替换旧方法,但它不存在.
很奇怪,因为我用网络应用做了类似的事情,它确实存在.
添加对System.Configuration.dll的引用.Here’s an explanation.