ASP.Net MVC Scribblings
  • Introduction
  • Introduction
    • My ASP.net MVC Scribblings
    • Test
  • ASP.net MVC
    • Routing
    • Passing Data in MVC
      • ViewData and ViewBag
      • ViewData / ViewBag
      • TempData
      • Session Variables
    • ModelBinder
    • Advantages of MVC over WebForms
    • Data Annotation
    • RAZOR
    • ActionName decorator for overloaded Controller actions
    • Security
      • CSRF
      • XSS
    • Shared Layout page
    • Custom Claims-based Windows Authentication in ASP.net MVC 5
Powered by GitBook
On this page

Was this helpful?

  1. ASP.net MVC

Advantages of MVC over WebForms

  1. Webforms has code behind and Page Lifecycle Events. Every action on the page has to go through an expensive lifecycle events before finally executing the action or method associated with the user's event.

    Also, the code you write in an Element's event (e.g Button_Click event on an aspx page) is not reusable

    In MVC, a user action's hit is directly received in Controller's action. Thus there is no expensive lifecycle events execution involved.

  2. Also, the controller's action now carry the code of some action event and thus can be reused in multiple requirements.

  3. With MVC, the response sent back from a Controller's action can be a HTML view, or JSON or XML. But in Webform, you only have aspx's processed HTML response back. To send back JSON or other content, a lot of configuration needs to be done.

  4. Unit testing becomes easy with MVC , its very complex to test aspx code behind but in MVC, controller's and model's being simple classes, its easy to unit test those.

PreviousModelBinderNextData Annotation

Last updated 5 years ago

Was this helpful?