Conditions: .Net MVC 5 project template.
Idea: Block all folders files access besides content/scripts, using only project root web.config
Solutions I found, but not satisfied with:
Hide every folder adding such structure into web.config
<location path="Upload"> <system.web> <authorization> <deny users="*" /> </authorization> </system.web> </location>`
Does not suit due to, there might/would be different folder names and you should always change it for every project based on this template, new folder added
Using this block:
<security> <requestFiltering> <hiddenSegments applyToWebDAV="true"> <add segment="Upload"/> </hiddenSegments> </requestFiltering> </security>`
Does not suit due to, there might/would be different folder names and you should always change it for every project based on this template, new folder added. Also it is not block by folder, it blocks by url, so if you have routing with e.g. /api/upload/movie/ - to any controller - it will be blocked
So, is there any solutions, to block all folders files, besides some I'm 100% sure are save?