Run Your First Razor Code in WebMatrix

In this chapter you will learn
  • Write Your First Razor Syntax in WebMatrix
  • Execute Your Code
So, I think that the Overview of Razor Markup and WebMatrix has finished. It's time to do some practical based activity. In this chapter you will write your First Razor Syntax in WebMatrix and debug your program to see output. In the previous chapter you have already learned how to use WebMatrix to write Razor Markup.

Programming Example

In this programming Example, I will show the current date and time in the browser using C# and Razor Markup.  
<html lang="en">
        <meta charset="utf-8" />
            string year,day,month,time;
        <h5>Current Year: @year</h5>
        <h5>Current Day : @day</h5>
        <h5>Current Month: @month</h5>
        <h5>Current Time: @time</h5>

Current Year: 2016
Current Day : Tuesday
Current Month: 8
Current Time: PM 05:43


This is just an example of razor markup to teach you how to debug program using WebMatrix. If you have successfully debugged this program at your PC and get desire output in web browser then you are absolutely ready to learn Razor Syntax.

Share your thought