Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you write your own View engine for ASP.NET MVC?

I know that ASP.NET MVC will allow me to swap in various View engines that other people have created, but I am wondering how can I create my own View engine?

More info: We have our own webforms based CMS and the main selling point about MVC is that it gives us cleaner HTML (which our designers would love). However we have a desire to create our own domain-specific View implementation.

like image 801
Falkayn Avatar asked Dec 27 '08 12:12

Falkayn


People also ask

Can we create our own custom view engine using MVC?

As you know MVC is highly extensible hence you can completely replace the Razor view engine with a new custom razor engine.

What is the default view engine used for ASP.NET MVC projects?

ASPX or Web Form Engine is the default view engine for ASP.NET that is included with ASP.NET MVC from the beginning itself. The syntax used for writing a view with the ASPX View Engine is the same as the syntax used in the ASP.NET web forms.


1 Answers

OK, I did some Google-fu and found these posts:

Adding support for skins in an ASP.NET MVC application

Partial Rendering & View Engines in ASP.NET MVC

I think I can work it out from what these guys say - I just hope that it still applies in the latest ASP.NET MVC drop!

EDIT: There is also a nice post about using VB.NET XML literals for a view engine.

like image 58
Falkayn Avatar answered Sep 19 '22 12:09

Falkayn