4

I've recently taken an existing ASP.NET 3.5 web forms application that was upgraded to .NET 4 last year (and has been running fine) and configured it to also run ASP.NET MVC3 following Scott Hanselman's blog post: Integrating ASP.NET MVC 3 into existing upgraded ASP.NET 4 Web Forms applications. It works well and I've successfully begun to introduce views based on Razor and the existing aspx pages continue to work.

The one thing that has stopped working, however, is a custom HttpHandler (our load balancer hits a specific address to ensure the application is available - the handler is for that address). The web.config has always declared the handler in the system.web section like this:

<httpHandlers>
  <add verb="*" path="system/heartbeat.aspx"
    type="My.Monitor.HttpHandlers.LoadBalancerHandler, My.Monitor"/>
</httpHandlers>

Now we're testing post-MVC3 and I'm getting an exception that reads:

The controller for path '/system/heartbeat.aspx' was not found or does not implement IController.

I have defined a RegisterRoutes method in my Global.asax and that method is called from the Application_Start. Within RegisterRoutes I've got the IgnoreRoute declarations from Hanselman's blog:

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

which I thought was to prevent the Routing system from taking anything with an extension of .aspx.

I can reproduce the issue in VS2010 as I debug, and the deployment environment is running IIS 6.

What can I do to prevent the Routing system from trying to handle that address so the custom handler can do it's thing? Any help is appreciated.

1 Answer 1

10

Try like this:

routes.IgnoreRoute("system/heartbeat.aspx");
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, Darin, that seems to have taken care of it. I still don't understand why the routes.IgnoreRoute("{resource}.aspx/{*pathInfo}"); didn't do the trick - but I can live with mystery as long as stuff works.
@BigPigVT, the following blog post provides a good insight about the IgnoreRoute extension method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.