none
How to add custom configuration section under existing configuration element? RRS feed

  • Question

  • Hi All,

    How to add custom configuration section under existing configuration element?

    My requirement is i need to have a custom configuration element under "roleManage" element, where in i would like to define some mapping between my application roles and provider roles.

    For example

    <roleManager enabled="true" defaultProvider="ActiveDirRP">
    <providers>
    <add applicationName="/" name="ActiveDirRP"  ...... />
    </providers>
    <RoleMappings>
    		<RoleMap key="Admin" groups="i_Project_Admins, i_NetworkAdmins" />
    		<RoleMap key="Contributor" groups="i_Project_Contributors" />
    		<RoleMap key="Reader" groups="i_Project_Readers" />
    	</RoleMappings>
    </roleManager>

    I have basic knowledge of creating the Configuration element and configuration element collections. Also i added configuration sections which works directly under Configuration tag. but i need the same to work under above specified tree location. 

    Thanks in advance.

    Regards,

    Suhas T J


    Suhas T J

    Thursday, September 5, 2013 8:17 AM

Answers

  • Since the RoleManagerSection class, class of roleManager element, is sealed, I don't think it is possible to add new configuration elements under it. So alternative is to create RoleMappingsSection and use that as section separated from roleManager section. The you just can create a abstraction at the code that reads both sections and does the stuff you would to if RoleMappings could be under roleManager element.

    Thursday, September 5, 2013 8:27 AM

All replies

  • Since the RoleManagerSection class, class of roleManager element, is sealed, I don't think it is possible to add new configuration elements under it. So alternative is to create RoleMappingsSection and use that as section separated from roleManager section. The you just can create a abstraction at the code that reads both sections and does the stuff you would to if RoleMappings could be under roleManager element.

    Thursday, September 5, 2013 8:27 AM
  • MasaSam

    I felt so. Thanks for your response. This answered my question.

    Regards,


    Suhas T J

    Thursday, September 5, 2013 8:48 AM