Change a page based on a user's profile.

I am looking for best practices or a solution on how to change a page based on a logged in users profile.  I am able to authenticate users against our LDAP and pull their group membership information, however, what is the best way to change the page based on their group membership information.  For example, I have a set of buttons, and only certain user groups should see certain buttons.  I am not sure of the best way to proceed.  My application is written in C# with a SQL server back end.  

shanemayAsked:
Who is Participating?
 
pr0t0c0l12Commented:
Use trimming principles.  Here you can find some good help about trimming based on the user's roles, rights...
This time tracker has trimming enabled and it is just perfect for what you want to do...

http://www.asp.net/downloads/starter-kits/time-tracker/

Download them and try it.  
0
 
dwaynecharringtonCommented:
I'm not sure how C# exactly works but with principle couldn't you simple use variables and change their data with an SQL query?

I mean structure the page as you would. Perform an SQL query with the user id of the logged in user or through the url. Put some variables in the page and set their data to that of your query.

Sorry if this is completely useless to you, or doesn't make much sense.
0
 
pr0t0c0l12Commented:
This is VB code but surely gives you a baseline to start on your c# code.  You might ask in their forums to see if they have the c# version.  

Overall asp.net will let you control what you want users to see based on their permissions and roles.
0
 
BTosonCommented:
I would just have a standard set of buttons on the page and change their visibility in the code behind based on the user's role using a switch or something
Some of these methods can also be used to ensure that when a user accesses a function they actually have permission to.
switch (rolename){
	case "administrator":
		//show relevant buttons for administrator
		break;
	case "user":
		//show relevant buttons for user
		break;
	default:
		//fall through
		break;
}

Open in new window

0
 
shanemayAuthor Commented:
Thank you for the feedback and advice.  
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.