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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:14:01+00:00 2026-05-26T16:14:01+00:00

My base controller has: [Authorize(Roles = sys_admin)] I want to have one action in

  • 0

My base controller has:

[Authorize(Roles = "sys_admin")]

I want to have one action in a controller that’s different and is available to “user” and “sys_admin”. Can I override and how do I do that?

Also any suggestions on what else I could put in a base controller that might make my coding simpler. For example what’s in your base controllers?

  • 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-05-26T16:14:02+00:00Added an answer on May 26, 2026 at 4:14 pm

    In my base controllers I actually put some utility method ([NonAction]) collected over time. I prefer to add functionalities to Controllers by decorating with Attributes if possible.

    Lately my base controller has:

    • some Properties for retrieving information about the current user (my app
      specific informations, not the User.Identity stuffs)
    • A simple protected override void OnException(ExceptionContext
      filterContext);
      override for at least logging unhandled exception and have
      some sort of automatic notifications
    • A bunch of Cookies related methods (WebForms auth cookies management
      for example)
    • A bunch of usefull standard attributes (usually [Authorize], [HandleError], [OutputCache]) in its declaration.
    • some standard method for preparing widely used json data types on the fly (when possible I prefer to have a standard json object with ErrorCode, ErrorMessage and a UserData).

    With time you’ll find more and more utilities to keep with your controllers, try to keep an assembly with the simpler ones (avoiding heavy dependencies), will come handy with your next MVC projects. (the same goes for Helpers and to some degree also for EditorTemplates).

    For the Authorize Attribute part, well, I think the cleanest way is to write your own AuthorizeAttribute class, specifically a NonAuthorizeAttribute. I think I’ve also seen it somewhere on SO.

    You can also play with the Order Property of the default AuthorizeAttribute – put different Order in BaseController and in Action, in order to have Action’s one executed first, but I cannot recall if you can actually break the Attributes processing chain.

    Regards,

    M.

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

Sidebar

Related Questions

I have controller with action new , and I want it to create ActiveRecord::Base
I have a BaseController that all Controllers inherit from. The CaseController has the [Authorize]
I have a base controller which is defined as follows, but the constructor that
I have a search form that can search in different provider. I started out
My controller has abstract base controller. I want to access the form post data
I have an ActionFilter that is applied to my base controller which checks certain
Is it possible to make a filter that, after a controller action has been
In my base controller's constructor I am calling an extension method that checks for
Fragile base class is one of the most common point that gets popped up
My base class has properties that are used by a subclass. where should Release

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.