gpt4 book ai didi

c# - 是否可以以编程方式在 web.config 中创建位置元素(例如使用 ConfigurationLocation)

转载 作者:行者123 更新时间:2023-11-30 22:37:49 25 4
gpt4 key购买 nike

我可以访问和修改 web.config 中 标记的内容,从:

Configuration config = WebConfigurationManager.OpenWebConfiguration(virtualFolderPath); 
ConfigurationLocationCollection locations = config.Locations;

然后对于每个位置:

Configuration thisConfig = location.OpenConfiguration();

但是,我看不到任何添加新 的方法,这可能吗?

最佳答案

web.config 是一个合法的XML 文档。因此,抛开其他考虑因素,没有什么可以阻止您加载它并使用 XMLDocument/XPath 或 XDocument 方法来修改和保存文件。

关于c# - 是否可以以编程方式在 web.config 中创建位置元素(例如使用 ConfigurationLocation),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6346699/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com