开发者

Child web.config can't clear <pages><controls> from parent web.config

开发者 https://www.devze.com 2022-12-26 23:44 出处:网络
How can I \"clear\" the vendor defined <controls> in my child app\'s web.config? Parent Web Config.

How can I "clear" the vendor defined <controls> in my child app's web.config?

Parent Web Config.

<system.web>
    <pages>
        <controls>
             <!-- START: Vendor Custom Control -->
             <add tagPrefix="asp" namespace="VENDOR.Web.UI.Base" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral />
             ...
             <!-- END: Vendor Custom Control -->
             ...
           </controls>
       <tagMapping>
         <add tagType="System.Web.UI.WebControls.WebParts.WebPartManager" mappedTagType="Microsoft.Web.Preview.UI.Controls.WebParts.WebPartManager" />
         <add tagType="System.Web.UI.WebControls.WebParts.WebPartZone" mappedTagType="Microsoft.Web.Preview.UI.Controls.WebParts.WebPartZone" />
       </tagMapping>
     </pages>
</system.web>

Child:

<system.web>
    <pages>
        <controls>
            <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        </controls>
        <tagMapping>
            <clear/>
        </tagMapping>
    </pages>
</system.web>

I have it working for开发者_Go百科 the <tagMapping> section, but <controls> does not support <clear/>.


There is a little known way of stopping web.config inheritence. In your case you would stick a <location inheritInChildApplications="false">...</location> around the <system.web>...</system.web> element. Of course this would remove the inheritance of everything in the section but it would solve your inheritance problem if that is what you are looking for.


Try <remove/> for each tagprefix, possibly in conjunction with a <clear/> at the top

0

精彩评论

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