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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:09:44+00:00 2026-05-23T15:09:44+00:00

I am using my own controller factory in an MVC 2 app, and this

  • 0

I am using my own controller factory in an MVC 2 app, and this standard code which seems to be going around:

    protected override IController GetControllerInstance(RequestContext reqContext, Type controllerType)
    {
        ...

        // Error handling
        if (controllerType == null)
        {
            throw new HttpException(
                404, String.Format(
                    "The controller for path '{0}' could not be found" +
                    " or it does not implement IController.",
                    reqContext.HttpContext.Request.Path
                    )
                );
        }

        ...
    }

The problem I was having is one others have asked about, where certain resources where being caught by this error handling logic and my ELMAH has been getting populated with hundreds of pointless errors. More annoyingly, it makes debugging painful to have to keep F5-ing the errors. These resources are: favicon.ico, Error.aspx (my custom error page), and some images in a particular folder.

So I followed the advice of this post, and attempted to solve the issues through ignoring routes in the global.asax:

    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        routes.IgnoreRoute("elmah.axd");
        routes.IgnoreRoute("/Content/images/{*pathinfo}"); // This has succesfully rid me of a bunch of errors
        routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.([iI][cC][oO]|[gG][iI][fF])(/.*)?" }); // This has successfully rid me of the favicon error
        routes.IgnoreRoute("{*allaspx}", new { allaspx = @"(.*/)?.aspx(/.*)?" }); // NOT SURE OF THIS ONE

        ...

        );
    }

As I’ve mentioned in the comments, this has cleared up many of the errors. The problem I now have is that when I start the application, I’m immediatley given a 404 screen of death, telling me my custom error page cannot be found. The error details:

System.Web.HttpException (0x80004005): The file ‘/Error.aspx’ does not exist.
at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
at System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)
at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

And the web config section:

<system.web>
   <customErrors mode="On" defaultRedirect="Error.aspx" />

   ...
</system.web>

The error page was working just fine before I made the changes to the routing. If I comment out the /content/images path – the app works again (though I’m back to “The controller for path ‘{0}’ could not be found or it does not implement IController” errors). Commenting out the favicon or allaspx route has no change on this 404 error.

Any help would be greatly appreciated.

Cheers,

Tim.

  • 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-23T15:09:44+00:00Added an answer on May 23, 2026 at 3:09 pm

    The issue was badly setup error page.

    I went back to the very beginning, and this tutorial. I did not have an ErrorController and was using the HandleError attribute. Following the instructions in this link fixed it up the problems with the error page. The answer to ignore routes worked for the favicon. The other files were genuinely missing files.

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

Sidebar

Related Questions

I am using my own controller factory and sometimes in function public IController CreateController(RequestContext
I am using an Account Controller which doesnt have its own table but uses
I'm developing an interactive MFC application which displays a 3D object using my own
I have a REST web service using spring MVC which is external-facing. I would
In rails, page templates have their own controller which is called before a page
I currently using my own membership implementation on a ASP.MVC project. I've got an
For some years that I've been using my own PHP template engine, which is
after using own custom cms for over 6 years, I decided to go for
I am using my own custom authentication with IIS, and I want the server
I am using my own implementation of the UserDetailsService interface to load a User

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.