How can I restrict ImageResizer to server certain file types and others not?

23 views Asked by At

I have a directory full of PDF and JPG files (EBooks). The jpg files are public and should be served by ImageResizer in several scenarios. The pdf files are not allowed to be accessed this way. For some internal reasons I cannot split the directory content and put the files in different directories. I also want to avoid to copy the jpgs into a new directory and duplicate them all. The most easy solution would be to allow only jpgs to be called. How to?

1

There are 1 answers

0
Herbert On

Ok, problem solved. It can be done using the MIME Types on the site/application.

When adding

<staticContent>
    <remove fileExtension=".pdf" />
</staticContent>

to the system.webserver section of web.config, pdfs are no longer accessible. All file types to be hidden or secured can be set up this way.