Force the ASP.NET MVC3 handler to ignore the .cshtml and .vbhtml URLs and just pass them

It looks like MVC3 has a priority handler for the .cshtml and .vbhtml file extensions and tries to find them in the default folder.

When requesting these URLs:

  • domain.com/test.cshtml
  • domain.com/test.vbhtml

MVC always looks for these specific static files in the default folder.

Regardless of the extension or route, I want it to completely ignore the processing of .cshtml and .vbhtml and just pass the full URL like all other URLs, so I can take care of routing myself (using Nancy).

Running MVC3 + Nancy + Razor in IIS 7.5 using Azure as an example.

+5
source share
1 answer

Add

<configuration>
  <appSettings>
   <add key="webPages:Enabled" value="false" />
  </appSettings>
</configuration>

web.config. Nancy (0.10), Razor web.config

+4

All Articles