简体   繁体   中英

PhoneGap to develop ASP.NET MVC applications

I'm new using this technology (and using ASP.NET MVC) so I want to create an app using the logic of .NET with Phonegap.

I searched information about if it's possible to create a PhoneGap application with ASP.NET MVC, and I found only negative answers.

Why the developers not recommend to use PhoneGap with .NET techology? I know that PhoneGap is only HTML-CSS-JS and not uses a server to run databases (probably I'm not correct with this).

I thought: I can move the logic of PhoneGap to my solution of Visual Studio, but I noticed that is the same thing if I create a new MVC application and then modify the HTML-CSS-JS files on Visual Studio as if I were developing in the workspace of PhoneGap.

Then, what's the difference? It's recommended use PhoneGap to develop ASP.NET MVC applications?

Sorry for my bad english, and I'll appreciate your answers.

It is a popular misconception from those new to PhoneGap. PhoneGap runs html/css/js pages on the local device within a webview control. It does not run a web server, so no server-side technologies can be used for the pages themselves: no ASP.Net (incl MVC), no NodeJS, no ColdFusion, no JSP, no Ruby, no PHP, etc. All these require a service on a web server to run/interpret code on the server to generate html pages.

A good way to look at it is as if you ran the html file from your local file system in a browser, ie open file C:\\myWebPage.html in your browser. If it is plain html, css, and js, it will run and display properly. If it had server-side technologies/code, it would not.

That is not to say you cannot use ASP.Net with a PhoneGap solution. Indeed, many developers do create web services, WCF services, and Web-API functionality in .Net, and use AJAX from javascript on the PhoneGap html page to get query results, partial pages, lists, data, etc from the server. Most of my PhoneGap projects use ASP.Net Web-API for server side functionality. And now with the Visual Studio Tools for Apache Cordova , you can have the PhoneGap multi-device project in a solution with your web service project.

Also, you can use MVC on the PhoneGap html pages, using javascript frameworks like AngularJS, Ember, etc. There are dozens to look at and choose from, if that is your preference. You just can't use ASP.Net on the mobile device.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM