1
A
回答
6
我假设你想读的web.config中的AppSetting部分。 web.config文件的每个不同区域都以不同的方式加载。但是appSetting是为用户变量设计的。
WebConfigurationManager.AppSettings["VariableName"];
<configuration>
<configSections>
<appSettings>
<add key="VariableName" value="xxxx"/>
</appSettings>
....
1
你想检查应用程序设置吗?连接字符串?
去走遍System.Configuration.ConfigurationManager
.AppSettings[int index or string name]
.ConnectionStrings[int index or string name]
1
ConfigurationManager.AppSettings["YourPropertyHere"];
在
string connectionString = ConfigurationManager.AppSettings["MyConnectionString"];
0
如果您的AppSetting部分(名称/值对),那么这篇文章将告诉你如何看他们一个很好的例子后, :
相关问题
- 1. 从配置文件中读取错误
- 2. 从配置文件中读取语法
- 3. 从配置文件读取变量
- 4. 从文件中读取配置信息
- 5. 从配置文件中读取端点
- 6. 读取光路从配置文件
- 7. vertx - 从属性/配置文件读取
- 8. 从shell脚本读取配置文件
- 9. asp.net从类库读取配置文件
- 10. 从文件读取一个配置
- 11. ASP.NET无法从外部配置文件读取配置设置
- 12. 如何从MDF中提取aspx文件?
- 13. 如何从Flex中的配置文件读取数据?
- 14. 如何从web-inf读取弹簧配置文件
- 15. 如何配置Apache磁贴以从jar文件中读取jsps?
- 16. 如何从配置文件读取连接字符串?
- 17. 如何从新配置文件读取值
- 18. 如何从Azure配置文件获取所有配置设置?
- 19. 如何读取INI文件中的配置文件条目
- 20. 从位置读取文件
- 21. 从aspx页面读取FileStream
- 22. 任何从内存中读取JAAS配置文件的方式
- 23. 从XML文件读取Gtk3应用程序的配置设置
- 24. RequireJS:从app.js读取配置
- 25. Eclipse不会读取配置文件
- 26. PHPUnit不读取配置文件?
- 27. 读取配置文件的内容
- 28. 使用AppSetting读取配置文件
- 29. 火花阶读取配置文件
- 30. AWS CLI不读取配置文件
+1 WebConfigurationManager(来自System.Web.Configuration)是在ASP.NET中使用的正确对象,而不是ConfigurationManager – PhilPursglove 2010-04-03 08:45:43
谢谢,我得到它那样工作,只需添加全名:P – 2010-04-04 04:50:37