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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:41:14+00:00 2026-05-29T17:41:14+00:00

I have created an ASP.Net MVC Web Application and used NuGet to install Ninject

  • 0

I have created an ASP.Net MVC Web Application and used NuGet to install Ninject version 2.2.1.4 and Ninject.MVC3 version 2.2.2.0. This application uses forms authentication. I am having a problem getting Authorization to work…

This is my Application_Start method in Global.asax:

protected void Application_Start()
{
    AreaRegistration.RegisterAllAreas();

    RegisterGlobalFilters(GlobalFilters.Filters);
    RegisterRoutes(RouteTable.Routes);

    var kernel = new StandardKernel();
    // binding code goes here... 

    // Remove this dependency resolver and Authorisation will work...
    DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel));
}

And one of my actions in my controller:

[Authorize(Roles = "Admin")]
public ActionResult About()
{
    return View();
}

And the authenitcation section of my web.config:

<authentication mode="Forms">
  <forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>

The problem is that un-authorized users go staright to the About view instead of being redirected to the LogOn. I know that the problem is with the NinjectDependencyResolver becuase when I remove the “DependencyResolver.SetResolver…” line from the Application_Start un-authorized users are redirected.

I would be grateful for your help.

Regards, Phil

  • 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-29T17:41:22+00:00Added an answer on May 29, 2026 at 5:41 pm

    You shoudn’t set the DependencyResolver yourself.

    Read the documentation https://github.com/ninject/ninject.web.mvc/wiki/Setting-up-an-MVC3-application about how to set up an MVC application using this extension.

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

Sidebar

Related Questions

I have created blank Asp.Net-MVC 3 web application and want to write my own
I created a simple ASP.NET MVC version 1.0 application. I have a ProductController which
I have built an ASP.NET MVC web application that uses Entity Framework. To provide
I have created a custom attribute in my asp.net MVC application using the following
I have created a new ActionFilter for an ASP.NET MVC application that I'm creating.
I have created an multi thread application on IIS (ASP.NET MVC), When the threading
I have a pretty big web application that I created last year using ASP.NET
I have an ASP.NET MVC web application that implements a custom membership provider. The
I have an asp.net mvc application, which uses the default user database. It all
I have created an ASP.NET MVC application and am trying to use Castle Windsor

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.