4

I have request filtering enabled and "Allow unlisted file name extensions" is set to false. When requesting any normal path, including "http://localhost" I get a 404.7 error - "The request filtering module is configured to deny the file extension."

If I set "Allow unlisted file name extensions" to true then the site works fine.

I know that "http://localhost/" maps to Views/Homes/Index.cshtml" and .cshtml is explicitly allowed.

I am trying to figure out which file extension is causing the issue but can't find anything in the logs. I have all 55 "default" file types set to allow.

Chloraphil
  • 251
  • 3
  • 5
  • 15

2 Answers2

8

Try just "." as the file extension. This seems to work on a Windows 2008 R2 SP1 box with ASP.NET 4.

I haven't seen this documented anywhere, but it follows the same rule as the Handler Mappings for extensionless URLs that were introduced in ASP.NET 4 / W2K8 R2 SP1 (see Meaning of path attribute on handlers in web.config question).

Richard B
  • 186
  • 2
1

I think what you're trying to do is not possible.

MVC doesn't use file extensions. By setting "Allow unlisted file name extensions" to false, you limit IIS to just serve the extensions listed. As you can't add an 'extensionless extension' IIS denies the request.

In other words, you need "Allow unlisted file name extensions" set to true if you want to use MVC.

You don't have to allow '.cshtml' you can even deny access to it, MVC still works, because the view files are not served directly by IIS by read by MVC and then send via IIS to the client.

Peter Hahndorf
  • 14,058
  • 3
  • 41
  • 58