Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8354697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:37:53+00:00 2026-06-09T09:37:53+00:00

I am developing a site and have 3 basic user roles. The roles are

  • 0

I am developing a site and have 3 basic user roles. The roles are “admin”, “manager”, and “user”. I have blocked basic users from certain pages, but allow admin and managers access to others. I have created a seperate page to delete users, however, I do not want to allow someone from the role of “manager” to be able to delete someone from the role of “admin”. “user” roles do not have access to this page so I’m not worried about that. I have a drop down list that shows all the users and a button to remove the selected user and it is working. I would just like to add the security of not allowing “manager” roles to delete someone from an “admin” role.

Here is the code that I have so far for the onClick event:

string adminuser;
usertodelete = usersddl.SelectedItem.ToString();
if (Roles.GetRolesForUser(usertodelete) = "admin")
   adminuser = "admin";

if (Roles.IsUserInRole("admin") && User.IsInRole("manager"))
    statuslbl.Text = "You do not have sufficient privileges to remove this user.    Only Administrator's can remove administrators from the system.";

else
{
    System.Web.Security.Membership.DeleteUser(usertodelete);
    Response.Redirect("~/Account/DeleteAccount.aspx");
}

I know my if statements are wrong at this point in finding and assigning a certain user and checking their role.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T09:37:55+00:00Added an answer on June 9, 2026 at 9:37 am

    I would just like to add the security of not allowing “manager” roles to delete someone from an “admin” role.

    if (Roles.GetRolesForUser(userToDelete).Contains("admin") && !User.IsInRole("admin"))
    {   // only allow admins to remove other admins.
       statuslbl.Text = "You do not have sufficient privileges to remove this user.    Only Administrator's can remove administrators from the system."; 
    } else {
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a site that sends email notifications to users after certain events/user actions
I am developing a site where users will have permalinks for them like user.domain.com
I have an ASP.NET site that I'm developing. The layout is pretty basic. The
I'm developing a site with jQTouch, but it doesn't have style for a search
I'm developing a site using the CakePHP framework. I have a form which shows
I am developing a site for mob using jquery mobile. I have a content
I am developing a site using asp.net MVC. I have used AJAX for paging,sorting
I am developing a web site. Here I have implemented the URL rewrite in
In general, If I have a choice when developing a web site to use
I have a question about a site I'm developing. It is a database driven

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.