如何获得web配置位置的元素? [英] How get web config location element?

查看:132
本文介绍了如何获得web配置位置的元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获得web配置位置元素?



  ConfigurationManager.GetSection(的appSettings)返回好吧

ConfigurationManager.GetSection(位置)返回null

IE

...

 <位置路径=FOLDER / Page2.aspx > 

< /地点>


解决方案

你得到一个错误的原因是因为在.NET的自定义应用程序配置部分(在你的榜样位置部分,如)要求您提供自定义配置节处理程序。



您所需要的主界面使用是 IConfigurationSectionHandler



下面是关于如何创建自己的定制的MSDN文章配置处理器


How get web config location element?

ConfigurationManager.GetSection("appSettings") returns Okay

ConfigurationManager.GetSection("location") return null

I.E. ...

<location path="FOLDER/Page2.aspx">
...
</location>

解决方案

The reason you get an error for that is because in .NET, the custom app config section (such as the "location" section in your example) require you to provide a custom configuration section handler.

The main interface you need to use is IConfigurationSectionHandler

Here is an MSDN article on how to create your custom configuration handler.

这篇关于如何获得web配置位置的元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆