ASP.NET Core Web API vs ASP.NET Core Application - xamarin

First off, I apologise if this is a trivial question but I am getting so confused by the information I am reading. I have put off posting on here as I feel my question is too broad but I can't find a definitive answer. I am a C++ developer by trade but I am wanting to get into web development.
My end goal is to have a web API that is consumed by both a web app and mobile app. I want to get the structure nailed first by developing an web API and web app and then expand it to a mobile platform later on.
My aim is to have 4 separate sections - Database -> WebAPI -> Web App
-> Mobile App
all of which are protected with username/password etc.
I have decided to use ASP.NET Core but when creating an application I am given two options in visual studio - ASP.NET Core Application or Web API. I have tried creating a Web API and a separate Core Application but can't work out how to call the web API. I have also tried creating a Core Application as it seems like I should be able to do everything I want in one project but I am worried that the Web API won't be separated enough to be able to call from a mobile app.
I will be working with a database containing sensitive information so obviously want to protect access to the Web API and Web/Mobile app. I have been watching courses on Pluralsight about Identity but I have read that it doesn't work well with Web API's.
Basically I am getting extremely confused when in my mind my end goal should be relatively simple to achieve. If anyone could give me any pointers as to what technologies I need to use would be fantastic.

ASP.NET Core WebAPI is specifically designed for building REST-ful services.
ASP.NET Core Application is used to create web applications that returns both views and data (it's an analog of Asp.NET MVC from standard Framework).
Which to choose is really depends on kind of WebApp you are going to use. If you plan to use some SPA framework, you don't need mechanisms to generate views on server side - WebAPI is a great choice, otherwise choose Application. Here you can find more details on differences.
As of security concern, there no issues with WebAPI. It provides a lot of mechanisms to secure your API and restrict access to methods based on user's identity. Please look at this article as an example.

Related

API Driven Approach Vs Non-API approach

I am to start designing & architecting a fairly big database business application (data entry, notifications, reporting, data export and usual security restrictions for data). Multiple clients - mobile apps & multiple websites will be there. Plan to use Asp.net MVC5 & Sql server for the development. Phonegap will be used to create mobile apps.
I plan to create an API. All interactions to the Database will be through the API (a REST API). This REST API will be created using Asp.Net MVC5. The front end will be developed as an HTML5 App which calls this API using AJAX. All interactions with the API will be through AJAX calls. Need to expose some of these services (5%) to third parties also.
For e.g. for a supplier management feature, there will be services like SupplierAdd, SupplierEdit, SupplierDelete, SupplierList etc. in the API. HTML5 App will call them through AJAX and do required. Necessary security will be imposed for these services using a login and token based security system.
Plan to use some Javascript frameworks like Angular JS for front end.
The entire application is one with around 200 DB tables and lot of relationships between DB tables. Business logic is only moderately complex. This is mainly a data storage & reporting application.
Is there any problem with this full API based approach ?
Another approach suggested is to avoid AJAX and Javascript and use ASP.Net MVC itself. No separate API will be there for each operation. .cshtml will submit to the controller method and this method will call the Business Layer and do operation. Services which are needed for mobile apps and third parties alone are exposed as API. Is this a better solution ?
The issue which I see for the second approach is that when more and more mobile applications or websites come in future, it does not offer needed flexibility. Also, exposure of some of the services to third parties will be difficult.
I request experienced architects to comment.

MVC .NET or WEB API

We want to write a new web site for customer using SQL DB
and implement only one specific client.
what the recommended technology to be used:
Peure MVC.net
Web API and client side using AJAX
I will be glad to hear the causes, the consideration and the cost.
Thanks!
I tend to favour a web api to handle all of the database work (via entity framework), but use MVC for my front end application.
This way you have all the flexibility of an API should you want to use different frameworks in the future (Angular, ASP.net 5 etc), but you can still have the pleasure of working MVC in your front end site.

How Backbone.js with rest based service using Asp.NET MVC 4

I implemented some code using backbone.js in Asp.NEt MVC3 and found backbone.js very helpful. Actually I am developing the data warehouse application where user at view side can run/save his data analysis. And after relogin can re-run the saved analysis. On clicking the save button at toolbar system persist the analysis in DB.
My question is that can someone point links where backbone.js interacts with rest based service using Asp.NET MVC 4 so to save/retrieve the data in DB .
Please do advice me the better way as well.
I've built several very large systems on top of ASP.NET MVC4 and WebAPI, with Backbone, recently. I highly recommend WebAPI. It's very easy to use, and works very well with Backbone.
http://www.asp.net/web-api
As one example of an app that I've built with it:
https://ravenhq.com/
The registration, login, management, and account settings are all Backbone on top of WebAPI.

asp.net MVC Web API VS asp.net MVC 4 & MVC 3 internet application

i read about the beta version of asp.net MVC 4 web API , i think that it is related to building web services. So are these two frameworks (MVC 4 internet application & Web API) targeting different types of application or they may be used for building similar types of application but using different frameworks?
for example if i need to build an internet application for a registration system for a university or an internet shopping store (which i use to develop using asp.net MVC 3 internet application),, then will these two frameworks be suitable for these types of applications ???
Thanks for any help ...
BR
Those are just 2 templates. No matter which one you choose when creating the application initially you could always later change and add functionality. The MVC 4 internet application template is similar to the ASP.NET MVC 3 internet application template. It creates a default Home and Account controllers, it registers a default route and adds a couple of views.
The Web API template in addition to all this it adds an API route and an ApiController allowing you to expose RESTful APIs in your web application. The Web API is basically a simplified way to build RESTful services. Up until now this was possible with WCF but the Web API makes it really simple. The Web API could be self hosted. You don't need to put it in an ASP.NET MVC application.
The webapi makes it simple to create HTTP services. I have only used them to return json. You can use either for the types of applications you are building.
Take a look at this blog article from Scott Guthrie http://weblogs.asp.net/scottgu/archive/2012/02/23/asp-net-web-api-part-1.aspx
Web Api basically lets you create HTTP REST full services. The API also gives one full access to the http requests and responses in a type safe way.

Using .NET MVC 3 for mobile contact form

I am developing a mobile version of one of our clients sites. We have decided to go with JQuery Mobile and it is working great, so far. However, the client's desktop browser site has a contact form that was developed using .NET Web Forms. I have read that it is better to use MVC for this type of functionality on a mobile site.
Since all of the mobile site can be developed just using HTML5 and JQuery Mobile except for the contact form, would it make sense to only develop the contact form in MVC and link the rest of the site to it? Or, would it be better to develop the whole mobile site in MVC?
Bonus question, does anyone know if a .NET MVC 3 mobile site has any issues with load time in a mobile browser?
ASP.Net MVC is more light-weight than Web Forms in what it sends to the browser as (amongst other things) it doesn't have a viewstate, so for mobile devices where bandwidth may be limited (and just as a general good-practice), sending less HTML to the client will be better, and will help keep load times at a minimum.
Whether or not you develop the contact us page again in MVC or use the existing web forms page depends on many things, such as:
Does the contact form have enough visits to warrant the time it'd take to develop and MVC site just for that single page
Are there likely to be more dynamic pages in the future, if so it may be worth adopting a platform such as MVC now.
Do you have the time/skills required to take on an MVC site?
Will it look odd if the design of the contact form on the web forms site is different to the rest of the new mobile site?
It's all down to your situation, and whether it's feasible and possible to achieve.
Your other option would be to introduce mobile detection in your desktop browser site, and style the page differently depending on whether the client is a mobile device.
Regarding performance, 51degrees have a product that they say improves performance of ASP.Net websites on mobile devices. I've not tried it personally, as I've not developed a mobile site that has had the need for such a third party tool to boost its performance. From what I've seen, the performance is fine.

Resources