Add in your web.config file the following directive:
<location path="Caminho/Para/Pasta/Publica">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
Explanation
location.path
is the location/folder you want to lock;
deny.users="?"
blocks the access of anonymous users.
Example
For your case, you could deny everything and then release only what users can access. See an example:
<location path="Content">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
<location path="Content/Arquivo.js">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
In this case the first directive blocks all users to access the folder Content
. The second allows only the file Arquivo.js
.
I believe that in an easy way would not have, can do this easily by htaccess, by . net might be able to make a page it manages as if it were a tree (mapping) of folders and files and lock files by htaccess,
– Kallef