How to get more output from a Http404 error with Asp.Net MVC?

Asp.Net MVC has some tricky scenario where you can get a 404 error and you have no idea why. You have unit tested all your route but you still have a 404! This is crazy and you start burning time and turning around to figure out what is wrong. This is even more true with complex routing where a single variable can change the whole game.


If you get a 404 page, a quick trick is to check the source code of that 404 page. This way you will get some information:

  1. The controller that the route try to reach
  2. The action that is invoked

To do that, just right click the 404 page, select View Page Source.

If you are sure that the controller and action exist than you should verify that the Http Method is the one you want. For example, the code above has the controller and action but for Http Post only, not Http Get.

If you like my article, think to buy my annual book, professionally edited by a proofreader. directly from me or on Amazon. I also wrote a TypeScript book called Holistic TypeScript

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.