将 ASP.NET 网站转换为原生 Android/iOS 应用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12652028/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 11:20:29  来源:igfitidea点击:

Converting an ASP.NET website to a native Android/iOS app

androidasp.netioscross-platform

提问by Ron

I have an ASP.NET website I want to convert to a downloadable native app for iOS/Android devices. I was wondering if this was at all possible - I am aware of all the tweaks required to make the website mobile-friendly (server/client wise), but I'm currently unaware of how to compile the website as a native app.

我有一个 ASP.NET 网站,我想将其转换为适用于 iOS/Android 设备的可下载本机应用程序。我想知道这是否可能 - 我知道使网站对移动设备友好(服务器/客户端明智)所需的所有调整,但我目前不知道如何将网站编译为本机应用程序。

Also, since my site has server-side logic, the native app should work like my normal website, sending and receiving data between the client and server.

此外,由于我的网站具有服务器端逻辑,因此本机应用程序应该像我的普通网站一样工作,在客户端和服务器之间发送和接收数据。

Thanks, Ron

谢谢,罗恩

回答by Slavo

While you are right that a native app and a website are similar that they send and receive data from the server, that's probably the only similarity.

虽然您认为本机应用程序和网站在从服务器发送和接收数据方面是相似的,但这可能是唯一的相似之处。

As a concept native apps and websites are very different and I don't think you can expect to convert between the two. Depending on how the website is implemented, it might be more work or less work.

作为一个概念,本机应用程序和网站非常不同,我认为您不能期望在两者之间进行转换。根据网站的实施方式,它可能需要更多的工作或更少的工作。

ASP.NET encourages a development model where you don't think about the client and server as separate entities and tries to abstract the technology underneath (HTTP, HTML, web server). This is why most ASP.NET websites are usually implemented in a way which you wouldn't follow when developing an app.

ASP.NET 鼓励一种开发模型,您不要将客户端和服务器视为单独的实体,而是尝试抽象底层技术(HTTP、HTML、Web 服务器)。这就是为什么大多数 ASP.NET 网站通常以您在开发应用程序时不会遵循的方式实现。

I think your best bet is to either make the existing site mobile-friendly or just implement a native app from scratch. For info about the first suggestion, you can read Scott Hanselman's blog post. As for native apps, I'm sure you can find many resources through Google.

我认为你最好的选择是让现有的网站对移动设备友好,或者从头开始实现一个原生应用程序。有关第一个建议的信息,您可以阅读 Scott Hanselman 的博客文章。至于原生应用,我相信你可以通过谷歌找到很多资源。

回答by Gultekin

For the fast solution, create a mobile friendly responsive CSS for your existing site and use Cordova/Apache Phonegap shell to embed it as initial page.

对于快速解决方案,为您现有的站点创建一个移动友好的响应式 CSS,并使用 Cordova/Apache Phonegap shell 将其嵌入为初始页面。

If your ASP.NET page is developed using MVC, I would suggest you to write another HTML5 page that uses ASP.NET Web API and use it with Cordova. Of course, you can also choose to develop a native app in a native language of the platform (like Swift in IOS or J2ME in Android) if you can convert it to WEB API structure.

如果您的 ASP.NET 页面是使用 MVC 开发的,我建议您编写另一个使用 ASP.NET Web API 的 HTML5 页面并将其与 Cordova 一起使用。当然,如果可以转换为WEB API结构,你也可以选择用平台的原生语言(如IOS中的Swift或Android中的J2ME)开发原生应用。

It would be very hard to convert old-styled ASP.NET apps to mobile native apps. Once, I wrote a Cordava hybrid app for a similar issue that uses a browser object to open some local and server pages on the native app. Native part was used for header and tab control navigation. Hybrid apps are like native apps, you can download from app store / google play but they uses internal web browsers to show the content. Some part of your app can be still native.

将旧式 ASP.NET 应用程序转换为移动本机应用程序非常困难。有一次,我为类似的问题编写了一个 Cordava 混合应用程序,该应用程序使用浏览器对象在本机应用程序上打开一些本地和服务器页面。本机部分用于标题和选项卡控件导航。混合应用程序就像本机应用程序,您可以从应用程序商店/谷歌播放下载,但它们使用内部网络浏览器来显示内容。您的应用程序的某些部分仍然可以是本机的。

If you are interested in this Web/Hybrid app development approach, you can also look at Ionic Framework.

如果您对这种 Web/Hybrid 应用程序开发方法感兴趣,还可以查看Ionic Framework

Look at Hybridapps and Cordovafor the start. Good luck!

首先查看混合应用程序和Cordova。祝你好运!