Change a page based on a user's profile.

Posted on 2008-11-03
Medium Priority
Last Modified: 2013-12-17
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.  

Question by:shanemay

Accepted Solution

pr0t0c0l12 earned 1000 total points
ID: 22872904
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...


Download them and try it.  

Expert Comment

ID: 22872912
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.

Expert Comment

ID: 22872915
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.

Assisted Solution

BToson earned 1000 total points
ID: 22873047
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
	case "user":
		//show relevant buttons for user
		//fall through

Open in new window


Author Closing Comment

ID: 31512945
Thank you for the feedback and advice.  

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month14 days, 19 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question