Search code examples
asp.netvisual-studio-2010iisiis-expressstatic-files

Prevent Visual Studio Dev server, IIS Express and full IIS from processing static files


Using Visual Studio 2010 I put a breakpoint on Application_AuthenticateRequest today and noticed that requests for my images, css and js were being processed. I switched my web application project to use IIS Express and then full IIS, and my breakpoint was still hit on those static files

I was under the impression that full IIS at the very least would by default not serve those files through the ASP.NET pipeline. What am I missing here??


Solution

  • I ended up adding this to my web.config. I know all my static files will exist in these folders, so it works ok for my needs.

    <location path="scripts, styles, images">
        <system.web>
            <authentication mode="None" />
            <authorization>
                <allow users="*" />
            </authorization>
        </system.web>
    </location>