开发者

.NET ConfigurationErrorsException: The element may only appear once in this section

 <LoginManagersSection>
   <LoginManagers>
     <SiteLoginManagers site="*">
       <LoginManager businessObject="DealerTraining" regex="\/Training.*\.html"  />
       <LoginManager  businessObject="DealerSupport" regex="\/DealerSupport.*\.html"  />
       <LoginManager  businessObject="Regular" regex="\/(?!WebTrendsJS).*\.html"  />
     </SiteLoginManagers>
     <SiteLoginManagers site="xrn">
       <LoginManager  businessObject="DealerTraining" regex="\/Training.*\.html"  />
       <LoginManager  businessObject="DealerSupport" regex="\/DealerSupport.*\.html"  />
       <LoginManager businessObject="XrnDealer" regex="\/Dealer.*\.html"  />
       <LoginManager businessObject="Regular" regex="\//(?!JS).*\.html"  />
     </SiteLoginManagers>
   </LoginManagers>
 </LoginManagersSection>

We have multiple web sites, and those sites needs different LoginManager instances. Same login manager for any given regex rule may be overwritten in a differen开发者_运维知识库t site.

We have a custom section in our configuration files and I was trying to add one more SiteLoginManagers node with a different key.

The problem: I am getting

ConfigurationErrorsException: The element <SiteLoginManagers> may only appear once in this section.

Is it possible to do that ?

We are using .NET 2.0.


You need a custom IConfigurationSectionHandler (or ConfigurationSection) implementation to handle multiple sections. More details can be found here on CodeProject and in this MSDN thread.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜