Sunday, August 10, 2008

Making a file with no extension acccessible on IIS

We were doing some tests and as part of one of the tests, we had to access a file which was hosted on a server running IIS 6.0. The program was making a http Get request and was getting 404. Yeah, the fabulous 404 error. What was really happening was that server was returning 404 for all files which has no extension.

We searched around and asked local experts and almost everyone could tell us on how to add a file extension but almost every one had no clue on how to add a Mime type with no extension. We tried many crazy things.

So we searched and searched and finally were able to get past. Since it took some time for us to find a relevant info on web, I thought that I would write a small post on this. So here's what you need to do.

Go to IIS, then Server name and then the domain name where you need to make a file accessible with no extension. Click 'Properties' and go to 'HTTP Headers' and then click [Mime Types]. I am not giving step by step as I am assuming that you would be able to figure this out.

Now comes the real part. In the 'Mime Types' dialog, click [New]. You would get following.

Enter the following information:

* Extension - *
* MIME type - application/octet-stream

Remember the screen-shot has some other extension. Just ignore that and enter '*' for file type and application/octet-stream for MIME type and you are good. Hope this information is useful for you.