Introduction to the ASP.NET Web API

Play Introduction to the ASP.NET Web API

The Discussion

  • User profile image

    So is the recommended approach for MVC/WebAPI hybrid apps to go back over the wire to your REST API server from your MVC front end?  To me this seems like a situation where a shared domain model compiled separately into two apps makes more sense.  Then you serve HTML to browsers via MVC and JSON to mobile apps or other clients.  Otherwise I'm going from browser, over the network to the MVC server, over the network again (perhaps configured so it doesn't leave the datacenter) to my REST API endpoint, then to the DB, then back over each hop again.  

    Of course I know that SPAs & MVC js frameworks like backbone work nicely with REST APIs.  So ideally you'd skip the MVC part.  I guess I'm just used to the heavier back end tier, not simply shipping objects to a smart js front end.  

    Are there any other ways to integrate MVC & WebAPI?

  • User profile image

    @Dzejms:Ditto, I'm wondering the same thing(s).  So, I guess that's the goal of One ASP is to figure out how to tie all of this together properly.  Hopefully someone will confirm...?

  • User profile image

    Ditto again. I've been banging my head trying to figure out the "best" way to architect a system (and the VS solution and projects) that has an ASP.NET MVC 4 front-end for serving HTML/CSS to desktop browsers, while also having an ASP.NET Web API to serve JSON to a mobile-only website, with both projects using the same business and data layers on the back-end. In fact, I even asked a question during this aspConf session, but it got deleted (and, thus, never answered). :(

  • User profile image

    Thank you John

  • User profile image

    @g6temp: @Dzejms: It's a good question. We now have many ways (which is a good thing) to serve data and pages. I'll give you my 2 cents on this, for what it's worth. If you are already serving pages through MVC (or planning it) you could use that methodology to load the pages and their initial data. Then use the Web API to for gathering data from the client. This gives you a bit of hybrid scenario but it may yield a better user experience.

    For example, your View is loaded from a server side model and presented to the user. Then you could use the Web API to gathering data as the user interacts with the view. 

    Or you could gather the data on the server and convert it to JSON in the View. Then use Knockout to bind it. After that, all data requests could use the Web API so you don't re-post.

    Or if you could just load an HTML page for the Views (with or without MVC) and use a client side Views, using Knockout (or some other library).

    There are many variations ... it really depends on your team's skills, experience, and what you want to achieve. 

  • User profile image
    Rohit H

    Thanks Jhon,


    I hope someone writes a quick pros and cons of going each way.



  • User profile image


  • User profile image
    Some Guy

    You do realize that only you can hear other people's microphones? Very distracting and frustrating that you keep requesting people turn them off. Surely the solution should lie your end. And as for your cat, I mean come on.

  • User profile image

    Where can we download the source code? I checked on github it gives an error 404.

  • User profile image
    Raju Golla
  • User profile image

    Hello Sir::

    As i am studied BE (Computer science engg)in sri venkateswara college of engg at Sriperumbudur Chennai, I need help to learn ASP.NET and VB.NET and ADO.NET for my job recqutement ,so Ineed raleted videos and Notes for good Knowlege in framework....

  • User profile image

    Interesting Introduction to WebAPI, just like the fun I had with Ruby on Rails. Great advice on use of Fiddler to Test RESTful calls. I like the ASP.MVC/API as a simple way to have both HTML and API exposed services. (Not so convinced on the use of MVC clients though, I think that has created some confusion here) - I am still Keen to use Rich Silverlight Clients into these WebAPI.

    I guess since the WebAPI, is really exposing the raw ORM CRUD level methods will result in the 'business logic' layer moving into the Client layer. If we want the Servers, and Servers in the Cloud to do more centralised Business logic, I would tend to implement and expose WCF services exposed instead. (Also overcomes versioning and data hiding)

Add Your 2 Cents