ASP.NET 中的配置管理器问题
我正在尝试获取添加到 web.config 文件中的应用程序设置中的密钥:
<add key="ComponentXML" value="~/App_Data/Components.XML"/>
并且我正在尝试以这种方式检索该值:
string componentsXMLFile = "ComponentXML";
ConfigurationManager.AppSettings[componentsXMLFile ]);
但它很吓人:
Could not find a part of the path 'c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\~\App_Data\Components.XML
这根本不是我的项目文件夹的一部分,它指的是其他东西
我该如何解决这个问题?过去三个小时我一直被这个问题困扰。
请帮助我
谢谢期待
I'm trying to get the key that was added to the app settings in web.config file :
<add key="ComponentXML" value="~/App_Data/Components.XML"/>
and i'm trying to retrieve the value in this manner:
string componentsXMLFile = "ComponentXML";
ConfigurationManager.AppSettings[componentsXMLFile ]);
But it is freaking out:
Could not find a part of the path 'c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\~\App_Data\Components.XML
which is not at all part of my project folder, it is referring to something else
how can i solve this ? I'm stuck with this problem from past 3 hours.
Please help me
Thanks in anticipation
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这段代码驻留在 asp.net 网页中,这一行对我来说很有效。
我从此处找到了答案的来源 经过更多谷歌搜索后。
谢谢
This code resides in the asp.net web page and this line did the trick for me.
I found the source of answer from here after some more googling.
Thanks