Skip to content

How to assign a role to access only a particular page in asp

Gowri A

Asked Jun 8, 2014, 1:30 AM EDT1 answer
Share
LinkedInX
I had asp.net pages called Loan.aspx and Details.aspx which are not under any folder and Loan.aspx page has to be accessed by only role who is "employee" and Details.aspx page should be accessed by any authenticated user. Could u plz tell me how to configure this in web application web.config file.

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Biswa Pujarini Mohapatra
    +1

    Add the role in the location tag of web.config example if you want only administrator can access the page

    <location path="register.aspx">

                    <authorization>

                                    <allow roles="Admin" />       ---- You may add verbs as per the requirement like for Only Post Data (verbs="post")

                                    <deny users="*" />

                    <deny roles="*" /> --- now Deny all roles and users, this follows the TOP to DOWN approach

                    </authorization>

    </location>

    +1