简体   繁体   中英

What is the difference between ASP.NET and ASP.NET MVC?

I'm a complete beginner when it comes to ASP.NET but I want to learn it in order to build a web application that eventually will communicate with a cloud hosted SQL server. However, I cannot find any information that outlines the difference between ASP.NET web application and ASP.NET MVC2 web application (in visual studio 2010) so I'm not sure where to start. Can anyone give me a simple explanation/outline so I can decide on a tutorial to follow?

Thanks

ASP.NET is a web platform. It provides a layer that sits on top of IIS (the web server) which facilitates the creation of web applications and web services. ASP.NET MVC is a framework specifically for building web applications. It sits ontop of ASP.NET and uses APIs provided by ASP.NET. ASP.NET Web Forms is another framework specifically for building web applications, and the new ASP.NET Web API is a platform for building web services.

ASP.NET, at its most basic level, provides a means for you to provide general HTML markup combined with server side "controls" within the event-driven programming model that can be leveraged with VB, C#, and so on. You define the page(s) of a site, drop in the controls, and provide the programmatic plumbing to make it all work.

ASP.NET MVC is an application framework based on the Model-View-Controller architectural pattern. This is what might be considered a "canned" framework for a specific way of implementing a web site, with a page acting as the "controller" and dispatching requests to the appropriate pages in the application. The idea is to "partition" the various elements of the application, eg business rules, presentation rules, and so on.

Think of the former as the "blank slate" for implementing a site architecture you've designed more or less from the ground up. MVC provides a mechanism for designing a site around a pre-determined "pattern" of application access, if that makes sense. There's more technical detail to it than that, to be sure, but that's the nickel tour for the purposes of the question.

Good luck!

ASP.NET MVC2 web application is based on MVC pattern in order to facilitate unit test, without mocking pipeline asp.net, because it's very difficult. you don't have code on Code Behind in order to separate your code graphic and your code functional.

With MVC your application become independent from view. you can replace easily technology of creating view.

Read this article it's very interesting : http://msdn.microsoft.com/en-us/magazine/dd942833.aspx

If you have VS10 make a small ASP.NET (webforms) application and a small ASP.NET MVC 2 application, and examine the differences between them. It's a great way to learn.

Like ASP.Net web forms, ASP.Net MVC is development model to build web application in Microsoft .net framework. The major difference between them are ASP.net MVC is based on the MVC architecture. Where we have 3 independent tiers – Model, View Controllers which interact which each other to render HTML output.

Major differences

  1. Web forms is mainly has an event driven model. Where we have page level events(Page_load, pre render, page_init etc) and control level events. Which is not the case for MVC. The request life cycle is comparatively complex.(why complex because, the request has to goes through all the events before rendering the HTML output )

  2. Web forms is basically has an aspx page which contains UI controls and a code behind file. All the page level events and control level events are handled here. In MVC the View, Model , controller can exist independently (gives clear separation of concern)

  3. The SOC makes it easier for development as we can have separate developers for View(design html) and controller (implement business logic)

  4. Because of this tight coupling nature, web forms are not suitable for unit tests. In MVC we can write unit tests at both controller level, action method levels. Here we can mock the data to be passed to view and do assert the result from the action method for their different properties like view name, model properties, null check etc

  5. In web forms we have state full behavior. The server controls in ASPX page uses view state to retain their state during request response cycle. Since this view states are stored as hidden controls inside the page itself, and they are sent during request and response cycle, it makes them more heavy. Absence of view state and state less nature of MVC make it more light weight. Hence they are much more faster in request lifecycle.

ASP.NET is a web platform. It provides a layer that sits on top of the web server which facilitates the creation of web applications and web services. ASP.NET is a framework specifically for building web applications. It sits of ASP.NET and uses APIs provided by ASP.NET. ASP.NET Web Forms is another framework specifically for building web applications, and the new ASP.NET Web API is a platform for building web services

ASP.NET is a 2 tier application in which no separate section for the database and MVC is a 3 tier application in which view and logic is kept separate. In ASP.NET for each .aspx form one URL is generated, but in MVC the url's are generated based on the controller and by the router configuration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM