Today we are going to discuss Razor.NET (ASP.NET Razor). It is like a wrapper on .NET very useful easy to learn.
Before going further as you know I am big fan of WWH so we will use WWH (What, why, how) questionnaires What is Asp.net Razor (Razor.net)?
Razor is a free tool by Microsoft by which you can write your Server side code using either VB.NET or C# syntax or you can say Asp.net Razor is new technique for writing code.
It just likes your classic ASP & PHP code. You need to write code in design page and server side code start with @ symbol.
So it will be easier for you if you have some hand over classic ASP or PHP.
As you know in the near future everything is on Mobile, PDA, and touchpad and most probably on HTML5. So great news is as per my thought Razor is developed just because of that goal. It is simple and easy to use. It helps in Mobile web development.
How to use it?
To use Razor you have to download a new tool which is called Web Matrix. Web Matrix is new IDE for developing Razor Application, which provide various utility which help you in develop a Razor application. You can download IDE from http://www.microsoft.com/web/downloads/platform.aspx
What is CSHTML & VBHTML Extension?
CSHTML & VBHTML are new file extension in Razor. The CSHTML file denotes that code is written in C# language and VBHTML denotes that code is written in VB.NET.
What is @RenderPage () function in Razor?
If you are ASP or PHP developer than you are aware of how to include a file. Render page function is used for reusable content. For example suppose you define a layout in which you have header page, footer page and content page and header page & footer page you required in all the content page then you have to write just a simple line to include that file
Other than this there are so many useful function like IsPost , @RenderSection(), @RenderBody Etc
which we will discuss in our next post.
Thanks for Reading
Enjoy weekend with Razor,