I will try and be brief, I am finding when trying to create a custom route with a name and url of properties that my ASP.NET MVC app is returning a 404 file not found when hitting the route.
I have deduced this down to most likely be caused by the fact I have a folder on disk called Properties which is of course a common asp.net folder which is automatically created. I have found someone else who has suffered from this problem on SO, but looks like there has been no resolution, only to name your route something different!
Surely this is an oversight, or there must be a workaround? Obviously there will be many common directories you may need as routes and/or folders interchangeably, some of which we already know like Properties probably can’t be deleted! I also understand we need to honor real folders as URLs too, but I feel routing should take priority before looking at folders on disk.
If someone has any ideas on how to accomplish this it would be greatly appreciated. 🙂
Looking at the .NET reference source code, it doesn’t appear as if
Propertiesis special to the ASP.NET runtime (HttpRuntime.cshas string constants forbin,App_Code, etc.).Try renaming the physical
Propertiesfolder to something likeApp_Propertiesand editing the namespace of the files in there to match. You’ll also need to edit the.csproj/.vbprojfile too, since VS hides the Rename command for this “special” folder.Once you’ve done this, using some of the built-in behaviour in the project property tabs such as creating default settings and resources will cause the
Propertiesfolder to be recreated so you’ll have to open the.settingsand.resxfiles directly to edit them.