about Machine.config

  • Thread starter Thread starter Anandraj
  • Start date Start date
A

Anandraj

Hi All,
I have added the below line in the machine.config file
<add verb="*" path="*.js" type="System.Web.HttpForbiddenHandler"/>

I thought the above line will not serve files with .js extensions will not
be send to the client. but still i am getting the file.

If I do the same thing in other files like .asax, .cs files its working as
expected.

for some of the file extensions it is not working. Can any one please
expalin me When it will work.

If you have any links in the net, it will be helpful for me.



Thanks

Anandraj.A.
 
This will work only if the .js extension is mapped to the ASP.NET dll in the
IIS script map. Extensions like .cs and .config are processed by
aspnet_isapi.dll, but .js is handled directly by IIS which means that
machine.config doesn't get involved.

To get *.js to use HttpForbiddenHandler you would have to add .js to the IIS
script map with the same mapping as .aspx, etc., and also make your change
to machine.config. But you should realize that <script src="something.js">
would then no longer work in your web pages.
 
Back
Top