Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

It seems that MVC3 has a priority handler for .cshtml and .vbhtml file extensions and tries to locate 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 a default folder.

Regardless of the extension or the route, I want it to completely ignore the .cshtml & .vbhtml handling and just pass the full URL through like all other URLs so I can take care of the routing on my own (with Nancy).

Running MVC3+Nancy+Razor on IIS 7.5 on an Azure instance.

like image 808
DominiqueBal Avatar asked Oct 09 '22 22:10

DominiqueBal


1 Answers

Add

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

to your web.config. Starting with the next version of Nancy (0.10), the Razor engine will automatically add this to the web.config

like image 145
TheCodeJunkie Avatar answered Oct 18 '22 07:10

TheCodeJunkie