HOW TO: Protect Files with a Certain Extension

Solution

Solution steps:

  1. Configure IIS so that the file type/extension is mapped to the ASP.NET ISAPI filter. This is done using Internet Services Manager.
  2. If access to files of certain file type is to be unconditionally forbidden, also configure ASP.NET so that the file type is mapped to the HttpForbiddenHandler HTTP handler. This can be done by editing the Web.config file.

Reference articles: