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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:03:52+00:00 2026-06-13T16:03:52+00:00

I have 2 filters I’m trying to apply using Ninject’s BindFilter<> syntax, and they

  • 0

I have 2 filters I’m trying to apply using Ninject’s BindFilter<> syntax, and they are being applied with their dependency injection successfully. The problem lies in the fact that the one sorts out who the current user is and binds that InRequestScope, and has to run before the second one when checking for maintenance authorization – otherwise it doesn’t know which user you’re referring to.

The filter binding in NinjectWebCommon.cs looks like this:

kernel.BindFilter<CurrentUserFilter>(FilterScope.Global, 0).InRequestScope();
kernel.BindFilter<SetupRightsAttribute>(FilterScope.Controller, 1).WhenControllerType<MaintenanceController>().InRequestScope();

So in the Maintenance controller, I’m wanting the first one to run and then the second; in everything else just the first one – and this works, the second one is only used when browsing to something in my Maintenance controller.

The 2 filters are declared as such (irrelevant details excluded)

public class CurrentUserFilter : IActionFilter
{
    public void OnActionExecuting(ActionExecutingContext filterContext)
    // implementation - breakpoint 1
}

public class SetupRightsAttribute : AuthorizeAttribute
{
    protected override bool AuthorizeCore(HttpContextBase httpContext)
    // implementation - breakpoint 2
}

I’m expecting breakpoint 1 to be hit and then breakpoint 2, but for some reason it’s always breakpoint 2 first – and because it doesn’t know the user at this point it tells me I have no authorization.

I have tried many different permutations of FilterScope and order settings, even binding them in a different order, but nothing works…what am I doing wrong?

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

    Authorization filters are executed before action filters, because authorization is earlier in the MVC execution pipeline than processing the action.

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

Sidebar

Related Questions

I have a function with a chain of filters in jQuery. I am trying
I am trying to have filters dropdown in my CMS my model looks like
I have some filters applied on my input excel sheets, so I decided to
I have some filters expressed as a list of function List(MyClass => Boolean) .
I have multiple filters in my application, with one at the root. <filter> <filter-name>root</filter-name>
I have a listing in an UpdatePanel I have some filters for that list
I have three tables filters (id, name) items(item_id, name) items_filters(item_id, filter_id, value_id) values(id, filter_id,
I have checked the manifest filters over and over and I can't figure it
I have a view with filters, with remember last option. I need to get
I have an API that filters a set of objects based on the ID

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.