Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I developed an application that uses roles-base-security.
The principal policy of the application domain is configurated:
C#
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);

I want to restrict access to one of the methods in the application
and allow only users who have the role "admin" to be able to call the method.
Posted
Updated 3-Nov-10 1:38am
v2
Comments
Dalek Dave 3-Nov-10 7:38am    
Edited for Grammar and Syntax.

1 solution

using System.Security.Permissions;

C#
[PrincipalPermission(SecurityAction.Demand, Role = "Admin")]
    protected void UserInfo_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
    }
 
Share this answer
 
v2
Comments
souidi abderrahman 3-Nov-10 8:34am    
thx it is working :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900