Root Folder and Controller with the same name

Aug 14, 2013 at 2:21 PM
Edited Aug 14, 2013 at 2:48 PM
Hello guys,

Im using MVCCoderouting and its working just fine.

I ran into an issue that I hope somebody can help me.

I have one Project names "MyWebProject" using Asp.Net MVC 4. I have one folder called Folder1 at the very first level (same level as controller folders). I also have a controller called Folder1.

When I browse to folder1, I got 403 (forbidden) because mvc is looking at the "root folder" instead of routing to the controller.

Project Structure (reduced)
- MyWebProject
   - Controllers
       - Folder1
           Folder1Controller.cs
   - Folder1
   - Views
      - Folder1
         Index.cshtml
  
How can I ignore root folders and Always use routing based lookup ?

This post has exact the same issue (but I cant delete the root folder - it is a folder from NServiceBus and I cant get rid of it)
http://www.west-wind.com/weblog/posts/2012/Apr/05/Physical-Directories-vs-MVC-View-Paths


Regards

Bruno
Aug 14, 2013 at 2:56 PM
I found an answer for this issue:

By setting routes.RouteExistingFiles = true; will force MVC to route even existing files/folders :)

Thanks

Bruno
Marked as answer by maxtoroq on 10/15/2013 at 9:17 AM
May 7, 2014 at 9:54 AM
What should I do so that I can access the files withing the Folders aswell.

For example access this file : somewebsite.com/Folder1/hello.txt