How did you find out that this does not work? Give an example.
You may have placed the latter in the routing table. So try moving it so that it is added to the first routing table. The route collection is an ordered list of routes.
Also try the following: Routes.IgnoreRoute("Content/"); but your ignore version is also correct and should work.
Finally, I donβt know what you mean when you say that the user can see the entire contents of the Content folder: Isn't that right? The user should be able to download files from the folder, and we usually just need MVC to ignore requests coming into the structure, and therefore IIS can directly serve these files.
or did you mean that browsing is enabled and you want to disable it: in this case, go to IIS Manager and select your site and find the option to view the directory and disable it, as shown here .
source share