Default action not working

Imported from the CodePlex archive for reference purposes. Support for MvcCodeRouting has ended.

Commented on

I've got a project I'm using this library on, and I'm having an issue with the default action not being picked up in one of my routes. The route that shows up in routes.axd is as follows:

routes.MapRoute(null, "product/{action}", 
    new { controller = @"Home", action = @"Index" }, 
    new { action = @"Index|SelectCustomer|CustomerSelect" }, 
    new[] { "product.Web.Controllers" });

Which looks correct as far as I can tell. The Home controller's default action should be index. I'm then linking to the index action with:

<a class="appLink" href="@Url.Action("Index","~~product.Home")"></a>

Which generates the URL of:

<a class="appLink" href="/webdirroot/product"></a>

Which is also, as far as I can tell, correct.

However, going to that URL results in a 404. But, going to /webdirroot/product/index returns the proper page.

Have I run into a bug, or am I missing something?

Commented on link

Please send me a small project that reproduces the issue to maxtoroq@gmail.com

Commented on link

Ok, I managed to finally hunt this down in the process of building a sample project. It turns out I had a real directory in the project left over from something I was trying previously that shared its name with the route. I'm assuming that since that directory existed, IIS decided to serve the request from there when it was just the directory name, and when the action was on there, that didn't exist, so IIS served it with the runtime.

Sorry bout the false alarm

Commented on link

Glad to know you solved it. You can use the RouteCollection.RouteExistingFiles property to avoid this issue.