Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change route/folder precedence in IIS/ASP.NET MVC3

If i have a folder named xxx and a route like this:

routes.MapRoute(
    "TestRoute",
    "xxx/{action}",
    new { controller ="xxx", action="Index" }
);

By default, when i request /xxx, IIS will try to return a directory listing, but I want my route to have precedence over folders/files on requests.

How do i do this?

like image 441
Malako Avatar asked Dec 04 '25 10:12

Malako


1 Answers

Here's a post that describes your issue and has a solution: http://forums.asp.net/t/1251156.aspx/1

Here's the meat of the answer on the link I provided:

By default, DirectoryListingModule take precedence over UrlMappingsModule. Fortunately, it is possible to change the order of UrlMappingsModule and DirectoryListingModule.

Goes to IIS7 Manager -> Modules, in the right pane, click View Ordered List, you can then use Move Down, Move Up to change the order of modules.

like image 98
bbak Avatar answered Dec 07 '25 12:12

bbak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!