简体   繁体   English

ASP.NET,两个Web.Config

[英]ASP.NET, two Web.Config

I have a .NET application with all the aspx pages and the main web.config in the root folder but I now have a situation where I need a portal like section for other users. 我有一个.NET应用程序,包含所有aspx页面和根文件夹中的主web.config,但我现在有一种情况,我需要一个类似于其他用户的门户网站。 I have created a new folder with it's own unique aspx pages and a second web.config. 我创建了一个新文件夹,其中包含自己独特的aspx页面和第二个web.config。

I especially need a second web.config to have the <authentication> with a <forms loginUrl="" defaultUrl="> for this portal section and a <authentication> too. 我特别需要第二个web.config来为<authentication> portal <authentication>设置一个<forms loginUrl="" defaultUrl=">这个门户网站部分和一个<authentication>

I have implemeted this second web.config in the way I created the first and I am getting this error message: 我以我创建第一个的方式实现了第二个web.config,我收到此错误消息:

    It is an error to use a section registered as allowDefintion='MachineToApplication' 
    beyond application level. This error can be caused by a virtual directory not being 
    configured as an application in IIS.

Now I think the main web.config file is conflicting with the this second webconfig in it's folder. 现在我认为主web.config文件与它的文件夹中的第二个webconfig冲突。 I'm not sure how to fix this, I have seen theories on how this works but no solid code. 我不知道如何解决这个问题,我已经看到了关于它是如何工作但没有可靠代码的理论。

Thank you for any suggestions and your time, it is much appreciated. 感谢您的任何建议和时间,非常感谢。

In IIS, create a virtual directory, under your main application. 在IIS中,在主应用程序下创建一个虚拟目录。 The local web.config will overide stuff in your main web.config, but still use you main web.config for everything else (ie ConnectionStrings, encoding, etc.). 本地web.config将覆盖主web.config中的内容,但仍然使用主web.config来处理其他所有内容(即ConnectionStrings,编码等)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM