We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

How to block our root folder EXE or Other extension file download from client sideRSS

1 reply

Last post Jun 11, 2019 02:40 AM by Jalpa Panchal

  • How to block our root folder EXE or Other extension file download from client side

    Jun 10, 2019 09:38 AM|jignesh.panchal1|LINK

    We are using IIS 8 on Windows Server 2012 R2 Standard
    we want to block some file extension to download from client side,
    so we are currently using webDev like below:

    <requestFiltering>
    <fileExtensions applyToWebDAV="false">
    <add fileExtension=".exe" allowed="false" />
    </fileExtensions>
    </requestFiltering>

    Is there any other best method for this?

    webDev will support in future version of IIS also?

  • Re: How to block our root folder EXE or Other extension file download from client side

    Jun 11, 2019 02:40 AM|Jalpa Panchal|LINK

    Hi Jignesh Panchal,

    You could try to add below code in web.config file:

     <handlers>
          <add path="./Files/*.txt" verb="*" type="System.Web.HttpForbiddenHandler" name="TXT" />
        </handlers>

    Note: this is for text file you could modify as per your requirement.

    In IIS there is no setting to restrict file. you could full fill your requirement by put some coding in your application or site. 

    The request filter module scans incoming requests and rejects requests that are unwanted based upon the rules that you set up.

    You could refer below article for more detail:

    Configure Request Filtering in IIS

    Regards,

    Jalpa

    .NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.