Thursday, October 17, 2013

HttpForbiddenHandler

How to block xml file download requests? Check out below.

If your code deploys to box having IIS7.0 only this web.config update is required.
In the Web.config file add the <httpHandlers> configuration element under the <system.web> element.

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


If your code gets deployed to box which has IIS6.0 or IIS 5.0 along with above web.config update you are required to add application extension mapping in IIS.