Decide if ASP.NET Web Forms, ASP.NET MVC, or ASP.NET Web Pages is right for you.
ASP.NET is a flexible web platform that enables you to build great web applications using three different programming models. Those models are ASP.NET Web Forms, All three of these programming models are fully supported options that are used by millions of developers. Let’s take a Look at how these fit together and why there are three choices. All these models build on top of the same core ASP.NET web platform.
ASP.NET and its Programming Models
Each model sits on top of ASP.NET and each model is ASP.NET at the same time, though, each model creates and structures a web application using slightly different approach just like people, each of them approaches different things. So there is offer for these different approaches because some developers prefer one set of values, and other developers prefer another set of values. All these programming models are good ones and solve real problems. But the programming model approach that is right for you depends on which feels most natural to you, and which set of values map to values you are looking for.
What Does ASP.NET Web Forms Value?
- Familiar Control and event-based programming model
- Controls encapsulate HTML, JS and CSS
- Rich UI Controls included – datagrids, chart and AJAX
- Browser differences handled for you
- SharePoint builds on Web Forms
What Does ASP.NET MVC Value?
- Feels comfortable for many traditional web developers
- Total control of HTML Markup
- Supports Unit Testing, TDD and agile methodologies
- Encourages more prescriptive applications
- Extremely flexible and extensible
What Does ASP.NET Web Pages Value?
- Easy to pick up and learn
- Inline Scripting Model with Razor and C# or VB.NET
- Simplified Model with top to bottom execution
- Full control over your HTML
- Friendly Helper syntax makes extending your apps easy
ASP.NET Web Pages is a simple model built around individual pages similar in ways to PHP or classic ASP. It uses the same Razor syntax that MVC does, but uses inline script rather than separate controller classes. However, you have the full power of the .NET Runtime and all the flexibility of C# and VB.NET at your fingertips. Web Pages gives the developer full control over the generated markup. The reusable methods and libraries that are used in Web Pages are called helpers and they are similar to Web Forms controls in that they encapsulate reusability functionality. However, Web Pages does not contain a page lifecycle like Web Forms does so there is no hierarchy like
Page_Render. You can generally think of ASP.NET Web Pages as executing top-to-bottom. Web Pages is also a powerful tool you can use within your Web Forms and MVC applications. You can add a Web Page here and there to augment your existing applications or extend them in new ways you perhaps had not thought of. Remember that choosing your programming model is not a fork in the road that can’t turn back from underneath each of Web Forms, MVC and Web Page is ASP.NET itself. All models share nearly all of their libraries with the core runtime. This includes Authentication and Authorization, User Membership, Role Security, Output Caching, Session State, Configuration, Deployment, AJAX and more. The skills and APIs you learn in these core libraries can be used interchangeably between Web Forms, MVC and Web Pages. Learn one, and you are well on your way to learning them all. Because it’s all ASP.NET underneath, you can also even choose to have “hybrid” applications that are built with any and all the programming models. It is up to you pick the right tool for the job. As an example, sometimes programmers use Web Pages for rapid prototyping and then move to MVC. ASP.NET makes it all possible and gives you a lot of flexibility.