开发者

SecurityTrimming, Custom RoleProvider and server 500 error :(

开发者 https://www.devze.com 2023-04-11 04:38 出处:网络
I have a custom roleprovider working with standard asp sitemap and menu control. I have securitytrimming enabled, and menu items successfully disappear/reappear as I amend the web.config as so:

I have a custom roleprovider working with standard asp sitemap and menu control. I have securitytrimming enabled, and menu items successfully disappear/reappear as I amend the web.config as so:

<location path="x/y/z.aspx">
        <system.web>
            <authorization>
                <allow roles="a, b, c" />
                <deny users="*" />
            </authorization>
        </system.web>
</location>

but unfortunately, whenever I visit such a page, I'm shown the very basic "500 - Internal server error."

If I remove the above lines from the config, no such error occurs (but everyone has access to the page!)

Could this be to do with my custom roleprovider? It seems to work with everything else! I've only overridden the IsUserInRole and GetRolesForUser functions (all other obligatory functions I return nothing or empt开发者_Go百科y arrays etc.).

Thank you! :)

EDIT:

I'm pretty sure this isn't my custom roleprovider causing the error.. I do have the following elsewhere in my web.config.

<location path="." inheritInChildApplications="false">

The bulk of my config was held in this section, the idea being that all my appSettings, sessionState, authentication options etc. would not be inherited into other applications, set up in IIS but which were held in subfolders of the application I'm working on now. Perhaps there are sections inside of this 'location' that aren't being transferred to other 'locations' (even though they're not child applications..!) confusing that the securityTrimming does work.... anyway by moving the contents of the above 'location' outside of that section, everything works again! Is there a way of having the best of both worlds?


Turn off friendly error messages in your browser to view the real issue.

0

精彩评论

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

关注公众号