0

This is probably a fundamental question concerning IIS 7. I currently have a website running on IIS 7 on my local machine. I've noticed that when I type in a URL of the form http://localhost/styles/default.css, my web browser will open up the css file in notepad. However, if I use an imaginary nonexistant file extension, IIS tries to hand off the request to my website, which happens to be an asp.net mvc application. Because the resource does not exist, the web application throws an error. I know that Request Filtering in IIS can block specified file extensions. However, if the file extension is not being explicitly blocked, how does IIS know whether it is a static resource vs routing it to the website for that particular binding?

One possibility is that IIS tries to locate the resource with the unknown file extension first, and, if it fails to do so, hands the request off to the web application (err... http handler, I guess that's the same thing...). Not sure if this is what's happening...

Many thanks in advance!

Andrew
  • 175
  • 2
  • 7

1 Answers1

1

What you want to check out is MIME types. Right Click on your server in IIS and goto properties. At the bottom is mime types. Thes are all the file extensions that IIS knows how to handle.

Here is link to stuff about configuring MIME types http://technet.microsoft.com/en-us/library/cc753281(v=ws.10).aspx

This should get you started.

theputter
  • 56
  • 1
  • Excellent, thanks! I was able to confirm by removing the MIME type for .css files, which caused the website to return an HTTP 404.3 error instead of opening the file in notepad. Good to know how that works:) – Andrew May 04 '12 at 10:31