asp-net mvc overview features and webform vs MVC difference
History of asp net framework
Before starting with asp net mvc let’s have quick intro to asp.net framework itself. asp.net is popular open-source framework for dynamic website and web-application development by Microsoft. The framework is successor of asp(Active Server Page) technology which is based on .NET framework. Win-form application had got immense popularity with .NET framework. C#.NET and VB.NET were the top choice for desktop based application development. Microsoft has released a framework called asp.net that makes desktop app developers easily develop web based application. It gives almost desktop like development experience by allowing server side control, control drag and drop and offering event drive mechanism on top webpages.
Asp net mvc release
The framework and technology developers used to build dynamic websites and web-application known as asp.net formview. Meaning there has to be a physical file associated with each requested page. The formview framework has evolved by the time and added rich set of functionality to build complex web application. But in late 2000 MVC based frameworks started gaining popularity. MVC got highlighted by the release of Ruby On Rails around 2005. There was MVC framework for almost all major web based technologies. 2009 was the year when Microsoft release it’s first MVC based framework offering as asp net MVC 1.
MVC pattern overview
MVC is architecture pattern. It offers separation of input logic, business logic and UI logic. It forms loose coupling between these modules.
Models are responsible for data persistence and business logic to process data. Models pull application’s heavy processing requirements.
Views are responsible for preparing UI(User Interface) mostly from the data received from models.
Controllers are the gateway to application. It handles user interaction. Based on request it decides which models to call for data processing and which views to call for output.
asp net mvc releases & features
asp net mvc is an opensource project from the start. And it built over the time by Microsoft team with community feedback and suggestions. Microsoft has also joined the open-source vegan. As part of all OS platform compatibility they have started open-source their entire .NET framework. In future Linux and MAC will have support to run .NET and all related technologies. Every iteration of asp net mvc has introduced rich set of utilities.
- asp net mvc 1
- MVC architecture with WebForm engine
- HTML Helpers
- Ajax Helpers
- asp net mvc 2
- Lamda expression based HTML Helpers
- Template Helpers
- Data Annotation Helper
- Client side validation
- Overriding HTTP methods
- Asynch Controller
- Client side validation
- asp net mvc 3
- Razor view engine introduced
- Remote Validation
- Sessionless controller
- Dependency Resolver
- Entity Framework support
- ViewBag support
- asp net mvc 4
- WebAPI support
- Improved default project template
- Mobile project template introduced
- Display Modes
- Support for Azure SDK
- Minification support
- asp net mvc 5
- One ASP.NET
- Asp.net Identity
- Asp.net scaffolding
- Display Modes
- Authentication filters
- WebAPI 2
- asp net mvc 6 RC
- Run other than IIS
- Cloud Optimize
- Environment based configuration
- Dependency Injection
- Supports OWIN
Difference between Webform and MVC
- asp net Webform
- Works on event driven mechanism
- Has server controls
- Can store state via Viewstate
- URL maps to physical files
- WebForm syntax for UI
- Closed source
- Uses aspx and aspx.cs for view and code separation
- asp net MVC
- Works on Model View Control architecture
- Has HTML controls
- Stateless in nature
- URL maps to controller functions
- Razor syntax for UI
- Open source
- MVC separate views from Models and Controllers code
When to choose webforms & asp net MVC ?
Advantages of ASP NET MVC:
- It divides entire application into Models, Views and Controllers thus reduces complexity.
- Uses front controller method to process requests through single controller. Meaning provides rich routing mechanism that can be customized based on application need.
- Supports TDD (Test Driven Development) and offers better unit testing support.
- Ideal for web application development where large number of developers working and for designers who need complete control over application behavior.
- It does not use viewstate or server forms. Thus it is ideal for developers who need more control over application behavior.
Advantages of ASP NET Webforms:
- It works on event drive model that preserve state on stateless HTTP. Offers rich set of server based control for rapid web application development. Ideal for those developers coming from .NET based desktop application development.
- Ideal for small team of programmers and designers who want to use hundereds of server based controls for rapid development.
- It offers view state which is helpful in storing state information across the requests on stateless protocol.
- It uses a Page Controller pattern that adds functionality to individual pages.
- It offers great level of abstraction on web development. It is less complex to build web application because page class and server controls are tightly integrated. Requires less code than MVC model code.
If you are large team working on large and complex project. Where designers need control on UI to make it interactive. Programmers need to separate concern code for lesser complex development. And Need more control over behavior then ASP NET MVC is for you.