在 asp.net 中创建自定义 .config 文件 [英] Creating a custom .config file in asp.net

查看:35
本文介绍了在 asp.net 中创建自定义 .config 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以在 asp.net 中创建一个 blah.config 文件,并像访问常规 web.config 文件中的项目一样访问节点的名称/值对?

Is there a way I can create a blah.config file in asp.net, and access the name/value pairs of nodes the same way you access items in in a regular web.config file?

(这个想法是不必为此编写任何自定义代码).

(the idea is to not have to write any custom code for this).

推荐答案

Chris 展示了一种外部化"部分配置的方法.这适用于某些场景.如果您需要更多,则需要深入挖掘.

Chris shows one way to "externalize" part of your configuration. That works fine for certain scenarios. If you need more, you'll need to dig in a bit deeper.

为此,您绝对应该在 CodeProject 上查看 Jon Rista 关于 .NET 2.0 配置的三部分系列.

For that, you should definitely check out Jon Rista's three-part series on .NET 2.0 configuration up on CodeProject.

强烈推荐,写得很好,非常有帮助!他展示了如何创建和使用自定义配置部分,并继续解释如何使用您自己的 blah.config 代替标准 .NET 配置文件,或者除了标准 .NET 配置文件之外.

Highly recommended, well written and extremely helpful! He shows how to create and use custom configuration sections, and goes on to explain how to use your own blah.config instead of or in addition to standard .NET config files.

马克

这篇关于在 asp.net 中创建自定义 .config 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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