tags:

views:

49

answers:

2

How to implement Variable Role Management in Forms Authentication.

The case is: We are tracking various projects across various stages... A Particular person Emp1007 could be involved in various projects in different roles... Project Lead for Pr001, Beneficiary for Pr002, Associate for Pr003.

There is a page, where in the user will be listed all the projects he is involved in, and can click on a particular project to perform some action on the same. From next screen onwards he must assume the role corresponding to the selected project, until such time, he comes back to the project listing screen.

How do I do this... Trust I made my requirement clear.

Included Later : My situation is the Role of a particular user must be decided on the basis of the Project he chooses... Further the same user will be needed to assign different roles during the same session... Is this possible? if yes, how?

Raja

A: 

Please Check this thread and check my answer http://stackoverflow.com/questions/995776/c-how-to-secure-webpages/995795#995795

Muhammad Akhtar
I think you mistook my question... I already know about location tag.. My situation is the Role of a particular user must be decided on the basis of the Project he chooses... Further the same user will be needed to assign different roles during the same session... Is this possible? if yes, how?
The King
+1  A: 

I think your problem is to assign roles at runtime. For this you can use Roles class. Msdn Document

Roles.AddUserToRole("King","Lead");

Also know that you can read user's roles when your projest listing screen is loaded

string[] userRoles = ((RolePrincipal)User).GetRoles();
Myra
Just a Quick Question... Does Roles.AddUserToRole assigns the role only for the session... Or Does it binds the user to the role permanantly??? If it is permanant how could that help me...
The King
It adds permanently yes,because there is a sql update running out.In your case,you need to assign role locally and when user closes his session you need to remove given roles for that user.
Myra
Or another idea come out.Define static roles for project,if user is assigned for project role,add role for that user permanently and so when project is completed no more users is needed to have role for that
Myra