Skip to main content
Logo
There is a newer version of Contensis. Click to find out more and download the latest version.

Razor View overview

The Microsoft® Razor View engine was released as part of ASP.NET MVC 3.0 as an alternative to Web Forms. The idea was that people with little or no development knowledge could write simple code to get dynamic data and/or content to display on a page by allowing you to mix HTML with simple .NET code.

Here’s an example that just lists the number of days.

would render

We’ve integrated Razor into Contensis so you can easily create custom features for your site using the Contensis WebAPI, for example,

Would list all content in the current folder.

You can use the WebAPI to develop a majority of the custom features you might need for your site.  This means development times will be faster and you code is easier to deploy. If you utilise the Desktop Tool, you can create and update your Razor Views locally before deploying back to the CMS.

Razor Views are created using 1 of 2 content types. C# Razor View and VB Razor View. This gives you the option use whichever .NET language you're most comfortable with. Because they are content types, then can go through the normal workflow, can be previewed and have permissions set against them. Also publishing a Razor View won’t publish all templates and pages the Razor View is included in. Only the Razor View itself.

This is a powerful feature that allows editors and developers to easily and quickly create and add custom features to sites that previously, could only have been built by a skilled .NET developer.