I have an application developed in .net vb and SQLServer, I want to restrict files js to be available to logged in users, but otherwise return a 403 error or similar. For example a user should be able to media/js/controller/myController.js
only if they're logged in.
I know how to control the actual displaying of the files aspx, ashx and ascx if they're not logged in, but not how to block access to the js file if they visit the link directly in their browser, for example http://www.myapp.com/media/js/controller/myController.js
. It's show my code javascript.
How can I achieve this?
UPDATE
It's my authentication mode in my web.config
<!--<authentication mode="Windows"/>-->
<authentication mode="Forms">
<forms name="AuthCookie" path="/" loginUrl="login.aspx" protection="All" timeout="2000">
<credentials passwordFormat="Clear" />
</forms>
</authentication>
<authorization>
<!--<allow roles="***" />
<deny users="*" />-->
<deny users="?" />
<allow users="*" />
</authorization>