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

  • Home
  • SEARCH
  • 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 8332107
In Process

The Archive Base Latest Questions

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

I try to implement a login for my application. The user can have multiple

  • 0

I try to implement a login for my application.
The user can have multiple roles (Viewer, Operator, Admin etc.).
But he has to choose a certain role that with which he wants to get logged in,
so he probably has administratior prviliges but he can login as a “Viewer” with no admin rights.

The problem is now that if I try to secure some functions with the RequiredRole attribute for an administrator, the user should not be able to access this function if he is logged in as viewer, even if he would have administrator rights.

Is such a beaviour supported from the framework or has anyone done something similar before?

Thanks anyway for your help

  • 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-09T02:37:42+00:00Added an answer on June 9, 2026 at 2:37 am

    You’ve not specified what you want to happen when he tries to do something that requires Admin when he’s logged in as Viewer, but since you can implement your own Role Provider, this is easy to do.

    You should be able to store something in the session or your user principal object stating the “available roles” (some of them won’t be able to pick Administrator, for example) and then another one for Selected Role. All you’d need to do is put some page into your site to allow the user to select their current role.

    Since you’d be using your own Role Provider, you can just implement this to pull the relevant information out of the Session (or the User Principal) when checking roles. You’ll still be able to use the RequiredRole attribute as you like.

    There are a few examples around of how you can change the behaviour from redirecting you to the logon form when you don’t have access to redirect you to a 403 page (e.g. With ASP.NET membership, how can I show a 403?). You could then show something on this page which would allow the user to switch to a higher role if they have one available.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The set-up: I have an android application that so far can register a user
I have a problem with facebook user login in my android application. I want
I try to implement footer datagrid with allowMultipleSelection properties. But in my case, it
I try to implement a browser-like app. I want to let it can open
I've try to implement integration tests for a working application (spring, hibernate, soap, cxf).
I had try to implement the send me log feature into my apps but
I have a requirement for an ASP.NET web application whereby the same user is
I'm trying to implement basic auditing for a system where users can login, change
I have implemented Twitter4J in my Android application and it's works fine. But after
In my application I have implemented a method to get favourits of particular user.

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.