You can force static files to go through the server to provide authentication by setting it to web.config:
Web.config
<compilation> <buildProviders> <add extension=".html" type="System.Web.Compilation.PageBuildProvider" /> <add extension=".htm" type="System.Web.Compilation.PageBuildProvider" /> <add extension=".js" type="System.Web.Compilation.ForceCopyBuildProvider"/> </buildProviders> </compilation> <system.webServer> <handlers> <add name="HTML" path="*.html" verb="GET, HEAD, POST, DEBUG" type="System.Web.UI.PageHandlerFactory" resourceType="Unspecified" requireAccess="Script" /> <add name="HTM" path="*.htm" verb="GET, HEAD, POST, DEBUG" type="System.Web.UI.PageHandlerFactory" resourceType="Unspecified" requireAccess="Script" /> </handlers> </system.webServer>
This will allow me to configure <authorization> in my web.config for the locations I want, for example:
Location: scripts / protected / demo
<authorization> <allow roles="demo" /> </authorization>
or Location: scripts / secure /
<authorization> <deny users="?" /> </authorization>
http://msdn.microsoft.com/en-us/library/h0e51sw9(v=vs.85).aspx
A similar question was recently if it helps:
Secure access to angular applications and the web API service
Dalorzo
source share