Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

web.config hiddenSegment only for root directory?

I added the following to my web.config so users can not download my plugins:

<system.webServer>
    <security>
        <requestFiltering>
            <hiddenSegments>
                <add segment="Plugins" />
            </hiddenSegments>
        </requestFiltering>
    </security>
</system.webServer>

Now I have the problem that not only domain.com/Plugins/MyPlugin.dll is blocked, but also domain.com/Scripts/ckeditor/plugins/ckplugin.js.

Is there a way to configure a hiddenSegment to only affect the root directory?

like image 997
Christoph Fink Avatar asked Aug 07 '26 01:08

Christoph Fink


1 Answers

I solved this via a web.config inside my plugins folder, where I block *.dll files from being downloaded:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="Plugins*.dll_*" path="*.dll" verb="*" type="System.Web.HttpForbiddenHandler" />
            <add name="Plugins*.pdb_*" path="*.pdb" verb="*" type="System.Web.HttpForbiddenHandler" />
        </handlers>
    </system.webServer>
</configuration>
like image 175
Christoph Fink Avatar answered Aug 08 '26 15:08

Christoph Fink