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 8962993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:15:41+00:00 2026-06-15T16:15:41+00:00

Our site has a complex administrative hierarchy with a a few behavioral splits. To

  • 0

Our site has a complex administrative hierarchy with a a few behavioral splits. To best direct user traffic, I created Authorization filters called MangersOnly, AdminOnly, NonAdmins.

I envisioned using them in this way

[MangersOnly]
public ActionResult Index()
{
}


[AdminOnly]
public ActionResult Index()
{
      return redirectoaction("Index", "Admins");
}

[NonAdmins]
public ActionResult Index()
{
      return redirectoaction("Shouldntbehere", "Errors");
}

What I sadly discovered was that attributes don’t act as overloads to my action methods.

This architecture is to avoid all the logic checks we have to do (if role this or that stay, else redirect to here or there…). The goal is to direct traffic to the action method who’s authorize attribute won’t fail.

Is there a way I can overload these methods (w/o changing their parameters or names), keeping this sweet (tho naive) architecture to channel users to?

  • 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-15T16:15:43+00:00Added an answer on June 15, 2026 at 4:15 pm

    In C# (and any other language I can think of) you can’t have more than one method (MVC or not) with identical signatures (attributes are not part of the signature); so this approach cannot work.

    How about generating the anchor links ()in the view) based on the permissions of the user e.g. IndexManager, IndexAdmin, etc and add the role based security as normal. The names IndexManager don’t make sense here which would make me think more about what is the user doing, is that a better name for the action? Only you know your domain to answer this.

    Or go with a base controller for common functionality and inherit for each security level behaviours.

    You might also want to consider permission based filtering not role based, see http://lostechies.com/derickbailey/2011/05/24/dont-do-role-based-authorization-checks-do-activity-based-checks/

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

Sidebar

Related Questions

Our web site has a fairly complex JS app that fails with the latest
our drupal site has some user specific content. When we enable page caching the
We are using Google Analytics for our site that has huge traffic. We are
There are 3 authors in our company blog, each author has own site url
Our site has a list of games and we get paid everytime someone signs
Our site has performance issues, and spambots make it worse, so we decided to
Any given article on our site has the meta tags for title, description, image,
Our site http://m.sa2010.gov.za has a simple menu structure that relies on floating divs to
Our SharePoint site has a couple of broad groups that use it. In essence
On our site http://www.viva.org/learn.aspx the Like Box plugin has recently stopped showing the Stream.

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.