How to use multiple view engines in ASP.NET MVC application

前端 未结 2 923
萌比男神i
萌比男神i 2020-12-19 22:21

I\'d like to use two view engines in my asp.net mvc web application. The first one is the Brail view engine from MVCContrib project, and another one is my custom view engine

2条回答
  •  天命终不由人
    2020-12-19 23:02

    Like this.

    EDIT: If your custom ViewEngine isn't handling *.json, you might well have a bug in your view engine. The easiest way to deal with this is to subtype VirtualPathProviderViewEngine and set the MasterLocationFormats, ViewLocationFormats, and PartialViewLocationFormats in the constructor. See the source code for WebFormViewEngine for a very simple example. This way the framework code does all the lifting for you.

提交回复
热议问题