VB.NET中,如何用appsettings替代已过时的ConfigurationSettings方法?
- 内容介绍
- 文章标签
- 相关推荐
本文共计235个文字,预计阅读时间需要1分钟。
我在我的VB.NET 2.0 Web应用程序中访问appsettings键值。我把密钥放在app.config文件中:appSettings add key=DownloadURL value=http://myURL/ //appSettings 我按照说明操作here,它说我需要像这样访问这个键:。
我试图在我的vb.net 2.0 Web应用程序中访问appsettings键值.我把密钥放在app.config文件中:
<appSettings> <add key="DownloadURL" value="<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.
本文共计235个文字,预计阅读时间需要1分钟。
我在我的VB.NET 2.0 Web应用程序中访问appsettings键值。我把密钥放在app.config文件中:appSettings add key=DownloadURL value=http://myURL/ //appSettings 我按照说明操作here,它说我需要像这样访问这个键:。
我试图在我的vb.net 2.0 Web应用程序中访问appsettings键值.我把密钥放在app.config文件中:
<appSettings> <add key="DownloadURL" value="<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.

