locked
I want to have multiple roles and give specific roles to specific folders using Identity and webforms RRS feed

  • Question

  • User-1360958501 posted

    Once upon a time I was easily led through these issues with wizards and setting web.configs within folders but now with Identity and Entity Frameworks nothing seems so simple.

    Can anyone point me to an example that does this completely rather just refer to it in passing.

    eg: If I can have a roles of Administrator and Accounts then I want only Administrator role people to have access to BlahBlah/Admin and similarly Accounts role people to have access to BlahBlah/Accounts

    Thanks in anticipation

    Wednesday, April 20, 2016 5:05 AM

Answers

  • User614698185 posted

    Hi geoffHome,

    If you want to apply URL authorization rules to a specific location, I create the sample for you, like below:

    <configuration>
     <system.web>
     <authorization>
     <deny users="?" />
     </authorization>
     </system.web>
    
     <location path="CreatingUserAccounts.aspx">
     <system.web>
     <authorization>
     <allow users="Tito" />
     <deny users="*" />
     </authorization>
     </system.web>
     </location>
    </configuration> 

    For more information, please see: http://www.asp.net/web-forms/overview/older-versions-security/membership/user-based-authorization-cs

    Best Regards,

    Candice Zhou

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 21, 2016 8:56 AM

All replies

  • User-1360958501 posted

    I think I want to know can I simply apply the access rules like the web.config

    At present the web.config stating 

    [<authorization>
    <allow users="Administrator" />
    <deny users="?" />
    </authorization>] 

    doesn't work or at least doesn't differentiate the roles permissions.  Logging on as anything seems to be sufficient and that's not what I want.

    Wednesday, April 20, 2016 7:15 AM
  • User614698185 posted

    Hi geoffHome,

    If you want to apply URL authorization rules to a specific location, I create the sample for you, like below:

    <configuration>
     <system.web>
     <authorization>
     <deny users="?" />
     </authorization>
     </system.web>
    
     <location path="CreatingUserAccounts.aspx">
     <system.web>
     <authorization>
     <allow users="Tito" />
     <deny users="*" />
     </authorization>
     </system.web>
     </location>
    </configuration> 

    For more information, please see: http://www.asp.net/web-forms/overview/older-versions-security/membership/user-based-authorization-cs

    Best Regards,

    Candice Zhou

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 21, 2016 8:56 AM