I am confused between razor and asp.net coding. Asp.net code itself is a server side code so why it is said that razor code is server side embedding code for creating dynamic web pages? Normal asp.net code also runs at server side so what is the need for razor than?

5 Years
Discussion Span
Last Post by internet_red

My understanding is that ASP.NET is using code behind - that the controls on the page are actual controls similar to what you have been used to when coding a windows application. The 'Raxor code' is actually a Razor view engine - which was introduced with MVC 3 (Model-View-Controller). The Razor engine takes code from the server and renders clean HTML in the browser. In your 'view' you can place html helpers with an @ sign to blend HTML and code from the server. Actual server code is handled in the Controller - which facilitates 'separation of concern' . A good source is the ASP.NET/MVC website and look for samples of MVC3. I didn't do much ASP.NET but I have been coding more and more MVC3 applications because MVC helps with your code updates, etc.
Hope that helps.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.