How can I remove the VB Razor Engine or configure the RazorViewEngine to not use and look for .vbhtml files on disk? For new ASP.NET MVC 3 Razor projects, I always remove the WebFormViewEngine in Application_Start because I won't ever be using it and so I don't need it to search for .aspx, .ascx or .master files on disk. For this same reason I would like to avoid .vbhtml file searching.
相关问题
- MVC-Routing,Why i can not ignore defaults,The matc
- Entity Framework throws exception - Network Relate
- parameters in routing do not work MVC 3
- Slow loading first page - ASP.NET MVC
- There is no ViewData item with the key 'taskTy
相关文章
- “Dynamic operations can only be performed in homog
- How to get a list of connected clients on SignalR
- How do you redirect to the calling page in ASP.NET
- Change color of bars depending on value in Highcha
- The program '[4432] iisexpress.exe' has ex
- ASP.Net MVC 4 Bundles
- How to get server path of physical path ?
- Cannot implicitly convert Web.Http.Results.JsonRes
This one keeps the original
RazorViewEngine
and cleans away the VB extensions.I figured I'd merge the examples from @tugberk and @Dimps:
This is the code for your custom view engine:
Register this on Application_Start method like this:
Like @Alex, combining and extending previous solutions.
Just in case you want to specify extensions for other ViewEngines, inherit from the 'original' and either build or filter (your preference, I just thought filtering seemed more work than starting a fresh list).
Usage:
Engine-specific:
Which uses:
There is no point in doing this.
However, if you really want to, you can clear
ViewEngines
, then register your ownRazorViewEngine
withFileExtensions
set to".cshtml"
.A summary from above with a single class.
Use it like this:
Class: