Reputation: 65
I'm new to ASP.NET, but not MVC. I'm curious - how does IIS/ASP.NET handle routes that are not registered with an ASP.net application?
e.g. http://localhost/unregisteredroute
If the route is not available in ASP.NET, does IIS take over and look for (index/default.htm/whatever
)?
Is there some way in ASP.net to specify that all unregistered routes be given 404s, instead of letting IIS resolve the URL?
Upvotes: 0
Views: 875
Reputation: 4163
The route you gave as example will probably return a 404 error, because ASP.NET MVC will try to match it against the default route. It will look for a controller called "unregisteredroute" with a method "Index".
May I suggest you read an easy to grasp overview of ASP.NET MVC routing? http://www.asp.net/mvc/tutorials/older-versions/controllers-and-routing/asp-net-mvc-routing-overview-cs
It's not as flexible as something like NodeJS routes, but it's pretty easy to configure and play with.
Welcome to ASP.NET ;)
Upvotes: 1