Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asp.net MVC web application and iOS mobile app

Tags:

ios

asp.net

I am currently writing a web application in ASP.NET MVC, so far it is mostly a simple CRUD web app. The database is hosted on the cloud and I am using Entity Framework to interact with it.

I know that further in the development cycle we will have to make a mobile application (iOS with swift) which will interact with the same database, so I want to have a good framework that will be able to handle both without too much duplication of code or DAL, while still being secure.

Those are the options I have so far:

  • Write my MVC web application and further down the line, make http requests to my controllers action from my app. Possible problems: Security and authentications of those calls?
  • Write my MVC web application and a MVC Web API. Both my controllers of my web app and the iOS app will interact with this API. Possible problems: Will this setup work with the asp.net MVC web app?
  • Write additional web methods in my MVC controllers specifically for the REST api call of my iOS app. Possible problems: Is it possible at all?
like image 934
Fynnen Avatar asked Dec 11 '25 10:12

Fynnen


1 Answers

I highly recommend that you go the option of an API that both your ASP.NET MVC web application and the mobile application both talk to. Using ASP.NET Web API for this is a good choice, as it works well with both, current, consumers (MVC and iOS) that you have. REST is a very open standard and, as such, allows for a wide breadth of devices to connect to it; ASP.NET Web API was built with REST in mind.

A JSON web token (JWT) approach to security would also be wise, as that will allow you to support a wide array of devices (cookies are limited in that respect). You might want to consider using OAuth on your ASP.NET Web API in order to leverage open standards security and leverage authentication via third party (Google, Microsoft, etc.) if that is desired or feasible for your project.

like image 82
Karl Anderson Avatar answered Dec 13 '25 00:12

Karl Anderson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!