Please differentiate between Razor and ASPX and also the goal of Razor's view with example.
Razor Vs ASPX and goal of Razor View.
470912-Feb-2020
Updated on 12-Feb-2020
Home / DeveloperSection / Forums / Razor Vs ASPX and goal of Razor View.
Please differentiate between Razor and ASPX and also the goal of Razor's view with example.
Nishi Tiwari
12-Feb-2020The Razor is a markup syntax that lets us embedded server-based code into web pages using C# and VB.Net since it is not a programming language and it is a server-side markup language.
The Razor has no ties to ASP.NET MVC because Razor is a general-purpose templating engine. We can use it anywhere to generate output like HTML. It is just like that ASP.NET MVC has implemented a view engine that allows us to use Razor inside of an MVC application to produce HTML.
We will have a template file which is a mix of some literal text and some blocks of code. We combine that template with some data or a specific model where the template specifies where the data is supposed to appear, and then we execute the template to generate our output.
Razor Vs ASPX
Goals
The Microsoft wants Razor to be easy to use and easy to learn, and work inside of tools like Visual Studio so that IntelliSense is easily available, the debugger is available, but also they wanted Razor to have no ties to a specific technology, like ASP.NET or ASP.NET MVC.
If users are familiar with the life cycle of an ASPX file, then they are probably aware that there is a dependency on the ASP.NET runtime to be available to parse and execute those ASPX files and also Microsoft wanted Razor to be smart, to make a developer's job easier.