views:

18

answers:

0

I have an location element in my web.config like so:

<location path="Admin">
    <system.web>
        <authorization>
            <allow roles="Domain\Development"/>
            <deny users="*" />
        </authorization>
    </system.web>
</location>

This works to only allow members of the development group access to this folder.

I was wondering if there is a way to simply test if a user has access to this folder?

One scenario is creating menu items. I'd simply like to hide or not render links to pages in this folder if the user does not have the proper rights.

Is there a way to do this in code. I don't want to have to hard code a check for membership in Domain\Development rather I'd like to use asp.net to tell me if this current user has access.

This would be nice if the rules get more complicated etc. Also having this in one place enforces DRY (Don't Repeat Yourself). Thanks