asp.net中有多个web.config [英] Multiple web.config in asp.net

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

问题描述

我有如下文件夹结构



MyApp

子文件夹:file.cs和web.config value = x

main.web.config value = y



我这里的查询是:是否可以访问主web.config文件值Y访问子文件夹file.cs?

或显示任何错误?



我以为可能吗?<

使用以下代码:



 System.Web.Configuration.WebConfigurationManager.AppSettings.Get(< span class =code-string>  Root);  //   Root是你的root配置应用设置密钥 







祝你好运


I have a folder structure like below

MyApp
Subfolder: file.cs and web.config value = x
main.web.config value = y

My query here is : Is it possible to access main web.config file value "Y" access in subfolder file.cs?
or display any error?

I thought Is it possible?<

解决方案

Use following code :

System.Web.Configuration.WebConfigurationManager.AppSettings.Get("Root");//Root is your root config app setting key




Good luck


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

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