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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:46:52+00:00 2026-06-04T12:46:52+00:00

I am using MVC Extension with Autofac and I am having issues with my

  • 0

I am using MVC Extension with Autofac and I am having issues with my areas. I’m not sure what I am doing wrong.

Initially I had the following in my global.asax.cs:

public class MvcApplication : AutofacMvcApplication
{
     public MvcApplication()
     {
          Bootstrapper.BootstrapperTasks
               .Include<RegisterControllers>();
     }
}

protected override void OnStart()
{
     AreaRegistration.RegisterAllAreas();

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

     base.OnStart();
}

public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
     filters.Add(new HandleErrorAttribute());
}

public static void RegisterRoutes(RouteCollection routes)
{
     routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

     routes.MapRoute(
          "Default", // Route name
          "{controller}/{action}/{id}", // URL with parameters
          new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
     );
}

With this code my areas displayed well. http://localhost:19857/Administration displays my Index view.

If I want MVC Extensions to register my routes and areas for me then http://localhost:19857/Administration displays nothing, just a 404 error.

This is the updated global.asax.cs to register my routes and areas:

public class MvcApplication : AutofacMvcApplication
{
     public MvcApplication()
     {
          Bootstrapper.BootstrapperTasks
               .Include<RegisterAreas>()
               .Include<RegisterControllers>()
               .Include<RegisterRoutesBootstrapperTask>();
     }

     protected override void OnStart()
     {
          RegisterGlobalFilters(GlobalFilters.Filters);

          base.OnStart();
     }

     public static void RegisterGlobalFilters(GlobalFilterCollection filters)
     {
          filters.Add(new HandleErrorAttribute());
     }
}

My RegisterRoutesBootstrapperTask class:

public class RegisterRoutesBootstrapperTask : RegisterRoutesBase
{
     public RegisterRoutesBootstrapperTask(RouteCollection routes)
          : base(routes)
     {
     }

     protected override void Register()
     {
          Routes.Clear();

          Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

          Routes.MapRoute(
               "Default",
               "{controller}/{action}/{id}",
               new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
          );
     }
}

Why won’t my areas display?

UPDATE

When I go to http://localhost:19857/Administration then defaults to the Dashboard controllers Index view. Here is my area’s registration code:

public override string AreaName
{
     get
     {
          return "Administration";
     }
}

public override void RegisterArea(AreaRegistrationContext context)
{
     context.MapRoute(
          "Administration_default",
          "Administration/{controller}/{action}/{id}",
          new { controller = "Dashboard", action = "Index", id = UrlParameter.Optional }
     );
}
  • 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-04T12:46:53+00:00Added an answer on June 4, 2026 at 12:46 pm

    I seem to have sorted out the problem. The problem is with the Routes.Clear(); I took it out and now everything is working fine. Here is my changes that I did to the code above:

    public class RegisterRoutesBootstrapperTask : RegisterRoutesBase
    {
         public RegisterRoutesBootstrapperTask(RouteCollection routes)
              : base(routes)
         {
         }
    
         protected override void Register()
         {
              Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    
              Routes.MapRoute(
                   "Default",
                   "{controller}/{action}/{id}",
                   new { controller = "Home", action = "Index", id = UrlParameter.Optional }
              );
         }
    }
    

    Here is my updated global.asax.cs:

    public class MvcApplication : AutofacMvcApplication
    {
         public MvcApplication()
         {
              Bootstrapper.BootstrapperTasks
                   .Include<RegisterAreas>()
                   .Include<RegisterControllers>()
                   .Include<RegisterRoutesBootstrapperTask>()
                   .Include<AutoMapperBootstrapperTask>();
         }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im using asp.net mvc 2.0. I have the following HtmlHelper extension: AdminOnly(HtmlHelper helper, IPrincipal
I created the following extension method for a ViewPage: using System.Web.Mvc; namespace G3Site {
I started the site using AST.NET Razor template, not ASP.NET MVC template. I recall
I'm using jqGrid with mvc 2 like this: jQuery(#extension_grid).jqGrid({ url: '/Extension/Report', datatype: json, direction:
I'm having an issue with my ASP.Net MVC application, I'm using MVC 3 with
I'm using telerik mvc grid and bound my columns throuugh Data Table, I having
I have started using Ninject 2 (downloaded from Github yesterday including the MVC extension
I'm using MVC and I've created a HtmlHelper extension function ImageLink. This function uses
I am rewriting urls in my ASP.net application (not mvc) using a custom module.
I am using Spring mvc within url rewrite tucky to have extension less Urls.

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.