1

In my ASP.NET 3.5 application, on the ASPX pages I have to implement role based data update policy.

If a user have lest privilege, he can still update some filed but not all. Where user with maximum privilege can update all filed on page.

I was trying to implement this using a generic approach, but not sure if .NET have some thing inbuilt to implement this.

What is the right approach here?

halfer
  • 19,824
  • 17
  • 99
  • 186
iPhoneDev
  • 2,995
  • 4
  • 33
  • 44

2 Answers2

3

Yes, you will want to utilize ASP.NET Membership. Once you have that in place, you can check roles on a user, like so:

if (Roles.IsUserInRole("User1", "Role1"))
    // allow whatever you need to
  • by this I have to keep code on each and every control on all pages. I am trying to find a generic approach. – iPhoneDev Feb 28 '12 at 21:20
  • @iPhoneDev You can definitely exercise DRY by putting this in a class and having the calls go to this one class to determine what files are able to be accessed by. This is pretty generic. –  Feb 28 '12 at 21:26
0

If you are using the asp.net membership provider, you can limit the content on the page based on the roles the user is in

aweis
  • 5,350
  • 4
  • 30
  • 46