Block download of files in IIS [duplicate]

2

I'm trying to block the download of my application's songs. I tried blocking by putting a web.config file in the folder with the songs with the settings below:

<?xml version="1.0"?>
<configuration>
    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" />
    </system.webServer>
</configuration>

But he still accesses the folder and lets you download the songs.

    
asked by anonymous 24.06.2015 / 22:37

1 answer

0

Taís , if your site provides music playback (audio) and you want to block the download of them (by source code, for example), you will need a script (in your case, aspx I imagine) intercepting the ".mp3" request to check the reference (or any other validations) releasing or not continuing the binary "dump" of the media file.

Eg: seu-site-de-musica.com/player.aspx?musica=10

Where 10 is the ID of the song in the database and player.aspx checks the reference of the request (ex .: If it does not come from the host-site-of-music.com host, then , block access).

Or, to make web.config block access to .mp3 files (or other extensions):

web.config :

<system.web>
    <httpHandlers>
        <add verb="*" path="*.mp3" type="System.Web.HttpForbiddenHandler" />
    </httpHandlers>
</system.web>

More information: link

    
24.06.2015 / 23:06