开发者

Concept of web.config file in Asp.Net

Could you please tell me how we will use more than 1 web开发者_JS百科.config file in asp.net?


You can use multiple web.config in different directories in the web application. This will help you to override any parent folder config settings

Multiple Web.Config files in ASP.NET web application


You can't use multiple web.config files as far as I know. You can however run create a new website that uses a different web.config file and has duplicate files.

If there is a particular setting you want to be variable, then your design sounds a bit inefficient and you should probably be handling those values outside the web.config file.

You can also split your config file into multiple parts, which is useful if it's hard to manage and want to modularise it. Do as follows:

Your Main.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings file="YourSettings.config" />
  <system.web>
    <!-- Continue as normal -->
  </system.web>
</configuration>

Then create YourSettings.config

<!-- Referenced by Web.config -->
<appSettings>
  <add key="Key" value="MyVal" />
</appSettings>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜