Click here to Skip to main content
15,562,816 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to avoid direct access of files to a virtual directory hosted in IIS for application. I tried directoryBrowse enabled as false in web.config. but still user is able to access the js/css files with in the virtual directory hosted.

What I have tried:

Code as below
under system.webserver section in Config file
<directoryBrowse enabled="false"/>
Updated 3-Dec-21 1:14am

1 solution

Turning off directory browsing will prevent the user from seeing a list of the files if they navigate to the directory.

However, the user will still be able to download the individual files if they navigate directly to the file itself. And if you block that, then none of the pages in your application will be able to reference those files either - you can't load a Javascript or CSS file into your page if you can't download the file.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900