LearningToCode
LearningToCode

Reputation: 153

Giving access to particular groups certain pages in c# asp.net application in windows authentication mode

I am creating a c# asp.net application.I have two groups group\a and group\b.I am currently applying windows authentication mode and letting only those users see my application who are in these two groups.

   <authentication mode="Windows"/>
   <authorization>
   <allow roles="group\a, group\b"/>
   <deny users="*"/>
   </authorization>

Now I want to add a feature where only people from group\a will be able to see a particular page. I tried adding following lines to my web.config file along with the above code.

<location path="onlygroupA.aspx">
<system.web>
<authorization>
<allow users="group\a"/>
<deny users="*"/>
</authorization>
</system.web>
</location>

I am getting access denied error even if I am a valid user.Please help me! Thank you!

Upvotes: 1

Views: 1499

Answers (1)

Jason P
Jason P

Reputation: 27012

<allow users="group\a"/>

should be

<allow roles="group\a"/>

allow users allows users with the specified usernames.

Upvotes: 1

Related Questions