How to register Custom View Engine in ASP.NET MVC?

To use your custom View Engine, you need to register it by using global.asax.cs file Application_Start() method, so that the framework will use your custom View Engine instead of the default one.

protected void Application_Start() {
    //Register Custom View Engine
    ViewEngines.Engines.Add(new CustomViewEngine());
    //other code is removed for clarity
}

 

Tagged , . Bookmark the permalink.

Leave a Reply