Link to home
Start Free TrialLog in
Avatar of Tombue
TombueFlag for Austria

asked on

Implementing user roles and permissions in C#

Hi,

I'm woking on a C# database app and I have to implent user roles and permissions. This means that different user can be defined which different roles. A admin has all rights, some users can read/write, others only can read for example.

I think, there are 2 basic methods:
1. Permissions in the SQL Server and handling it in code.
2. Handling completly in code without permissions in the database for a better independence from it.

What is your opinion?

Is there any pattern or code-example to implement user roles and permissions completly in code in C#???

Thank you very much!
Tom
Avatar of Cenjoy100
Cenjoy100
Flag of India image

Best example :

http://msdn.microsoft.com/en-us/library/ff647401.aspx#paght000013_step4
If you need any more help let me know.
Avatar of Tombue

ASKER

WOW so fast!!!

But I'm working with a Desktop-WinForms-App!?

I did not analyze the sample-code from your answer completly, but works this ASP.NET-Code in my app?

Is there any example for WinForms-Apps?
ASKER CERTIFIED SOLUTION
Avatar of gaurang04
gaurang04
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tombue

ASKER

Needed more explanation