Authorization for Static Files in ASP.NET MVC w/ Owin Authorization for Static Files in ASP.NET MVC w/ Owin asp.net asp.net

Authorization for Static Files in ASP.NET MVC w/ Owin


  1. IIS is serving static files , if you want to stop this you can remove default static file handler and than every request isserverd by MVC/OWIN.
  2. Than make static file handling and authorization in your controller: listen/map route where static files are located

to remove default static file handler add this to web.config file:

<configuration>    <system.webServer>        <handlers>           <remove name="StaticFile" />        </handlers>    </system.webServer></configuration>