Razor is an
ASP.NET
ASP.NET is a server-side web-application framework designed for web development to produce dynamic web pages. It was developed by Microsoft to allow programmers to build dynamic web sites, applications and services. The name stands for Ac ...
programming syntax used to create
dynamic web page
A dynamic web page is a web page constructed at runtime (during software execution), as opposed to a ''static web page'', delivered as it is stored.
A server-side dynamic web page is a web page whose construction is controlled by an application ...
s with the
C# or
VB.NET programming languages. Razor was in development in June 2010
and was released for Microsoft
Visual Studio
Visual Studio is an integrated development environment (IDE) developed by Microsoft. It is used to develop computer programs including web site, websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development ...
2010 in January 2011.
Razor is a simple-syntax view engine and was released as part of
MVC 3 and the
WebMatrix
Microsoft WebMatrix is a discontinued cloud-connected website builder and HTML editor for Windows, geared towards web development. WebMatrix enables developers to build websites using built-in templates or popular open-source applications, with fu ...
tool set.
Razor became a component of AspNetWebStack and then became a part of
ASP.NET Core.
Design
The Razor syntax is a template markup syntax, based on the C# programming language, that enables the programmer to use an HTML construction workflow. Instead of using the ASP.NET Web Forms (.aspx) markup syntax with
<%= %>
symbols to indicate code blocks, Razor syntax starts code blocks with an
@
character and does not require explicit closing of the code-block.
The idea behind Razor is to provide an optimized syntax for HTML generation using a code-focused templating approach, with minimal transition between HTML and code.
The design reduces the number of characters and keystrokes, and enables a more fluid coding workflow by not requiring explicitly denoted server blocks within the HTML code.
Other advantages that have been noted:
* Supports
IntelliSense
Code completion is an autocompletion feature in many integrated development environments (IDEs) that speeds up the process of coding applications by fixing common mistakes and suggesting lines of code. This usually happens through popups while typ ...
– statement completion support
* Supports "layouts" – an alternative to the "master page" concept in classic
Web Forms
ASP.NET is a server-side scripting, server-side web-application framework designed for web development to produce dynamic web pages. It was developed by Microsoft to allow programmers to build dynamic web sites, web application, applications a ...
(.aspx)
*
Unit testable
See also
*
Blazor
References
External links
Introduction to Razor Pages in ASP.NET Core at
Microsoft Docs
Microsoft Docs was a library of technical documentation for end users, developers, and IT professionals who work with Microsoft products. The Microsoft Docs website provided technical specifications, conceptual articles, tutorials, guides, API ...
*
ASP.NET Web Pagesat
Microsoft Docs
Microsoft Docs was a library of technical documentation for end users, developers, and IT professionals who work with Microsoft products. The Microsoft Docs website provided technical specifications, conceptual articles, tutorials, guides, API ...
Overview of ASP.NET Core MVCat
Microsoft Docs
Microsoft Docs was a library of technical documentation for end users, developers, and IT professionals who work with Microsoft products. The Microsoft Docs website provided technical specifications, conceptual articles, tutorials, guides, API ...
*
ASP.NET MVCat
Microsoft Docs
Microsoft Docs was a library of technical documentation for end users, developers, and IT professionals who work with Microsoft products. The Microsoft Docs website provided technical specifications, conceptual articles, tutorials, guides, API ...
* (archived). Current development is held at
{{Web frameworks
Razor
A razor is a bladed tool primarily used in the removal of body hair through the act of shaving. Kinds of razors include straight razors, safety razors, disposable razors, and electric razors.
While the razor has been in existence since be ...
2010 software
Free and open-source software
Free software programmed in C Sharp
Microsoft application programming interfaces
Microsoft free software
Microsoft Visual Studio
Software using the Apache license
Template engines
Web frameworks
Windows-only free software