从子站点 web.config 读取 AppSettings
我在我的默认网站中放置了一个子网站。在子网站中,我想将变量存储在其 web.config 中。
但是,每当我尝试检索这些值时,它们都不存在于 ConfigurationManager.AppSettings 中。
我已将该网站作为网站应用程序并将其创建为 IIS 中的虚拟目录,但没有成功...
有人有想法吗?
谢谢!
(顺便说一句,我正在使用 .NET 3.5 和 IIS Manager 6)
I have a a subsite placed in my Default website. In the subsite I want to store variables in it's web.config.
However, whenever I try to retrieve the values, they don't exist in the ConfigurationManager.AppSettings.
I have put the website as a website application and created it as virtual directory in IIS, no success...
Does anyone have ane idea?
Thanks!
(btw, I'm using .NET 3.5 and IIS Manager 6)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
仅供参考,您的子网站在
web.config
中称为虚拟目录,您需要做的就是将其添加到文件中:
是一个简单的NameValueCollection
,您可以在代码中对其进行迭代,如下所示:这是您正在做的事情吗?
just FYI your subsites are called Virtual Diretories
in the
web.config
all you need to do is add this into the file:the
<appSettings>
is a simpleNameValueCollection
that you can itenerate in your code like:Is this what you are doing?
没关系,
我已经解决了我自己的问题。
我正在使用 URL 重写,这导致服务器对我的项目的实际位置有点困惑。
Nevermind,
I've fixed my own issue.
I was using URL Rewrite which caused the server to get a bit confused about the actual location of my project.