3
Answers

Why we use ASP.NET MVC for single page applications?

Abolfazl

Abolfazl

8y
270
1
Hi
 
I'm new to single page application development and I see everywhere developers that work on single page application in .NET Framework use ASP.NET MVC, why they use MVC and why they not use Web Forms for single page applications?
 
thanks 
 
 
Answers (3)
1
Francis

Francis

NA 11.7k 724.2k 8y

This is a matter of preference. That's all! There is no rule that prevent you to go with webforms. Comparing to webforms, MVC is "light" weight in the sense, there is no complex "page" life cycle etc. Apart from that, MVC provide more control to render the HTML. These are the some reasons, that I find personally if I go with MVC and SPA. Hope this helps!

1
Bikesh Srivastava

Bikesh Srivastava

NA 19.8k 835k 8y
Read this,
"
  1. Traditional (non-SPA) web apps tend to refresh the entire page when a user submits critical new data (e.g. type of request) or requests (e.g. submit form). Examples of this include apps built using JSPs.
    • Forces most of the data validation activity to occur on the server.
    • The determination that the submission of page X with data Y should result in the user being taken to page Z is made using the model-view-controller (MVC) architecture, which is implemented on the server
  2. With the advent of AJAX, web apps started to refresh only the relevant portion of the page when a user submits new data or requests. For example, if a user selects state = Massachusetts, then the web app can immediately use an AJAX request to validate whether the entered zip code is valid for the state of MA. However, once the user submits a form typically the web app takes the user to a new HTML page.
    • Some or most of the data validation activity can occur on the client
    • The MVC implementation is on the server
  3. Finally, an SPA moves much of the MVC implementation to the client (using templating frameworks like Mustache and/or MVC frameworks like Backbone, Ember or Angular). Therefore, the new "page" is now virtual and simply involves the determination of the right set of widgets and data to represent to the new state of the page, but doesn't require an actual new HTML page. Therefore, it is called a Single Page Application.
    • Much of the data validation activity can occur on the client
    • The MVC implementation is on the client
"
1
Vinay Singh

Vinay Singh

NA 5.9k 126.1k 8y
Have a look of the link this will help you
http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/build-a-single-page-application-spa-with-aspnet-web-api-and-angularjs