I’m developing a Web application and running it using IIS. My application is a file server. I need to visualize files in the web browser and I have some troubles viewing some files or directories.
For example, I’m not able to view files with .cs extension or the content of directories called bin. The Web server returns a 404 for those URLs:
Server Error
HTTP Error 404 - File or directory not found.
Description: The resource you are looking for might have been removed,
had its name changed, or is temporarily unavailable.
Server Version Information: Internet Information Services 7.0.
I guess that this is a kind of protection that IIS has. My questions are:
- Do you know why IIS is filtering those files?
- Do you know how to configure IIS to allow retrieving those URLS?
And the most important question for me:
- I need to deploy my Web application for many costumers, so I would like to configure it programatically. Do you know if it can be configured in the Web application, instead the IIS properly? In other case, how could I configure it with a script or similar?
Well,
Finally I had to change the IIS settings, allowing to override the requestFiltering:
And then I used the following configuration in my Web.config:
Note that now all the files in the Web server are unprotected. You need to setup your rules in order to protect your bin directory, and also your code files, or whatever you want.