I think Microsoft must have a reason for enhancing ASP.Net with RAZOR syntax.
On the Create New Website Project dialog of visual studio, there is another option for creating ASP.Net (Razor). The first time I came across the term Razor was when I read a book on Asp.Net MVC, I didn't know it exists for ASP.Net
I know what the Razor syntax is for, introduced in MVC 3. Before asking this question, I decided to create a test project for ASP.Net (Razor) and see how it is different from the normal ASP.Net webforms and ASP.Net MVC. I discovered no Model/View/Controllers folders like we have in MVC.
I discovered that the Master page is specified differently and the Master page is cleaner, no more <asp:ContentPlaceHolder />
But my questions are:
- I notice it uses
.cshtml
, are there no more codebehinds?
- similarities and differences between ASP.Net (Razor) and ASP.Net MVC
- Can it be extended to function like ASP.Net MVC e.g. adding Controller?View/Model, Custom Routing I guess?
- Why does this exist when we have ASP.Net MVC? Wouldn't this encourage reluctance to move to ASP.Net MVC?
- and why would you choose ASP.Net+Razor over ASP.Net MVC?
UPDATE: ASP.NET Web Pages in particular was designed to make it easy for
people who already know HTML to add server processing to their pages.
It's a good choice for students, hobbyists, people in general who are
new to programming. It can also be a good choice for developers who
have experience with non-ASP.NET web technologies
Update ASP.NET Web Pages ASP.NET Web Pages targets developers who want a simple web development story, along the lines of PHP. In the Web Pages model, you
create HTML pages and then add server-based code to the page in order
to dynamically control how that markup is rendered. Web Pages is
specifically designed to be a lightweight framework, and it's the
easiest entry point into ASP.NET for people who know HTML but might
not have broad programming experience — for example, students or
hobbyists. It's also a good way for web developers who know PHP or
similar frameworks to start using ASP.NET.
Asp.Net Web Pages
Please, I need your technical opinion.
Thanks.
Copyright Notice:Content Author:「codingbiz」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/11380607/asp-net-webforms-vs-asp-net-websiterazor-vs-asp-net-mvc