How can i do this?
IIS intercepts the request because it contains the file extension and captures it, thinking it is a static file and does not transfer it to your application.
To make it work, you must tell IIS not to do it. Inside the <system.webServer> section, you can add the following handler to indicate that requests with the specified template should be processed by a managed pipeline:
<system.webServer> <handlers> ... <add name="ScriptsHandler" path="Scripts/Entities/*/datasource.js" verb="GET" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> </handlers> </system.webServer>
Some people may also tell you:
<modules runAllManagedModulesForAllRequests="true" />
but I would not recommend that you do this, because it means that all requests for static resources will now go through a managed pipeline, which can have negative operating costs for your application. The handler syntax allows you to selectively enable this only for specific route patterns and HTTP verbs.
source share