11

Ive been confused about ASP.NET MVC.

As some said, MVC is better than ASP.NET. As some said, they are completely the same thing. And my colleges debate that MVC is just an extension of asp.net, where asp.net is already in the form of MVC.

In fact I am starting web developing from scratch. If someone might help to clear the fog front of me, it would help a lot.

Yusubov
  • 5,815
  • 9
  • 32
  • 69
kitw
  • 323
  • 7
  • 15

6 Answers6

11

All ASP.NET web frameworks are build on top of Microsoft ASP.NET Framework. The unique feature of Web API is that it can be used with both MVC and WebForms applications to provide truly restful HTTP services.

Regarding the choice of suitable Asp.NET framework: you may get more information from official source - www.asp.net.

enter image description here

General rule of thumb is the architectural design how you want to build your application.

ASP.NET MVC promotes a cleaner separation which makes the developer think more in depth about design and code separation than traditional web forms.

There are endless debates about what is better but true benefits of ASP.NET MVC as

  1. testability
  2. more control over the rendered HTML
  3. separation of concerns. However with MVC there is much more to learn for the developer.

ASP.NET WebForms - will always be around because some see it as a rapid application development tool. Just drag and drop and let ASP.NET handle the posting, state etc

ASP.NET Web API - is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices. ASP.NET Web API is an ideal platform for building RESTful applications on the .NET Framework.

All in all, each of them has certain business solutions to be considered as required.

References to look for comparison:

Community
  • 1
  • 1
Yusubov
  • 5,815
  • 9
  • 32
  • 69
  • 2
    Many thanks for the answer, the figure real easy to understand the basic concept out of a 1000 words essays. – kitw Dec 19 '12 at 03:18
10

ASP.NET is the name of the overall web framework. There are a few different technologies that are built on ASP.NET. Two popular examples of these technologies are WebForms and MVC.

WebForms promotes a programming model that looks a lot more like Windows Forms. It attempts to abstract away the stateless nature of the web, and encourages you to use server-side controls instead of HTML. Because WebForms was the primary way to write web applications on ASP.NET for a long time before MVC came out, you'll often see people talk about "ASP.NET" as the same thing as WebForms. This is part of the reason for your confusion. ASP.NET WebForms is very different from ASP.NET MVC, but they are both built on ASP.NET.

ASP.NET MVC gets away from server-side controls. It eliminates the abstractions, allowing you to have closer control over the actual HTML that gets generated. For developers of modern applications, this is very useful because it makes it much easier to use AJAX and rich client-side javascript.

StriplingWarrior
  • 151,543
  • 27
  • 246
  • 315
  • 1
    +1 for the distinction between Web Forms and MVC. Web Forms was Microsoft's answer to rapid application development for the web. It's that rapidity of development which adds a lot of the 'bloat' that's not present in MVC. – Joseph Yaduvanshi Dec 19 '12 at 02:09
3

(Humble Opinion incoming)

ASP.NET (in terms of using Webforms) is programming the web for a WinForms developer. You "bind" events, you have "controls" and everything (sessionstate) is stored in a huge hidden field within the page so it knows where it left off from the previous call. You rely heavily on this information being present which is why everything you do needs to reside in that master form wrapping the entire page.

On the other hand, MVC is bringing C# .NET programming back to the web the way the web was intended. No bloat, no hidden fields, no heavy bindings. It's brings everything back to the classic "i have this form and now I need to process it". Arguably, the real magic is the routing methods and the "automatic binding" of submitted fields to an object. (if fields x, y & z are submitted and your action is looking for FooBar with the properties x, y & z it's automatically converted for you.

Brad Christie
  • 100,477
  • 16
  • 156
  • 200
  • 1
    That's a good explanation. But, ASP.NET MVC is just a set of handlers, modules, and extensions that sits on top of the same ASP.NET framework as ASP.NET Web Forms. – Joseph Yaduvanshi Dec 19 '12 at 02:07
  • @JimSchubert: indeed, however from an implementation standpoint its paradoxically different. You're no longer finding yourself `this.Control.Click += new EventHandler(Form_Submit)` but instead reverting back to ``. (I use reverting, but you're not finding yourself applying winforms logic, but more traditional HTML logic). To quote IBM, [KISS](http://en.wikipedia.org/wiki/KISS_principle). – Brad Christie Dec 19 '12 at 02:10
1

ASP.NET is common to both WEB-API and ASP.NET MVC. I assume you wonder about MVC or WEB-API. MVC is a controller / model based with Views. Although the controllers can be used for AJAX json purposes. MVC is a good way to build a serious Browser based Application. The WEB-API allows you to build simple http server features, not necessarily Browser related. Good for REST style programming. Very flexible and a good alternative to WCF services. The are good tutorials on Both on the official ASP.NET site. START here http://www.asp.net/get-started

phil soady
  • 11,043
  • 5
  • 50
  • 95
0

choose depends on your project n you. I suggest you to choose MVC because its productivity is very high we r using it since 1 year and found better than webforms.

for more knowledge please visit http://www.asp.net/mvc

imsurya
  • 154
  • 1
  • 6
0

The choice depends completely on you, I have been developing MVC application since 2010, its going to be over 2 years now have worked with almost all the versions of MVC both with Razor and aspx view. I have also worked on ASP.Net webform based applications.

With MVC you will not get built in controls, you will have to develop every control you want to use, you will have to rely mostly on html controls, while with web forms you will get advantage of using built in controls, Even getting help from other developers in your surroundings may be easy for webforms as you can easily get a webform developer.

But on the other hand with MVC the maintability is very high. As for as productivity is concerned, its very high once your are accustomed to it, initially it will be low as you will be in learning phase. Don't forget to use Entity Framework.

You may also consider developing your App using WebAPI, if it suits your scenario.

Niraj
  • 1,782
  • 1
  • 22
  • 32