用于结合传统和移动 ASP.NET Web 开发的资源

发布于 2024-10-30 13:26:17 字数 447 浏览 0 评论 0 原文

作为传统 ASP.NET Web 应用程序(非 MVC)的开发人员,我收到了对移动友好版本的请求,我想知道在哪里可以找到一些关于解决问题的最佳方法的智慧。目前,我们通过 Web 服务调用屏蔽了大部分数据库访问。

似乎许多商店都会发现自己处于这种情况:我们的资源有限,并且不希望由于应用程序的版本差异很大而造成维护麻烦。

是否有一组最佳实践用于采用现有的 System.Web 应用程序并重新组织代码以适应添加移动设备友好性。我想到的一般方法是:

  1. 在风格上做一些小的改变 使用 CSS 甚至 JavaScript 的客户端。
  2. 对数据进行任何必要的更改, 工作流,或服务器端的标记 代码。
  3. 保持尽可能多的代码通用 通过组织到两个版本 将非 UI 逻辑分成单独的 组件。条件编译 将在代码隐藏中使用,其中 用户界面必须有所不同。

使用这种方法我会遇到哪些问题?

As a developer of a traditional ASP.NET web application (non-MVC) who is getting requests for a mobile-friendly version, I'm wondering where I might find some wisdom about the best way to approach the problem. We currently mask most of our database access through web service calls.

It seems like many shops would find themselves in this situation: We have limited resources and don't wish to create a maintenance headache by having versions of an application diverge greatly.

Is there a set of best practices for taking an existing System.Web application and reorganizing code in order to accommodate adding mobile-friendliness. The general approach I'm thinking of is:

  1. Make small stylistic changes on the
    client using CSS or even JavaScript.
  2. Make any necessary changes in data,
    workflow, or markup in server-side
    code.
  3. Keep as much code as possible common
    to the two versions by organizing
    non-UI logic into separate
    assemblies. Conditional compilation
    would be used in code-behind where
    UIs must diverge.

What are the gotchas that I'll run into with this approach?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

但可醉心 2024-11-06 13:26:17

简短明了:

  • 阅读W3C 移动 Web 应用程序最佳实践
  • 单独 你的业务/应用逻辑和表现逻辑尽可能
  • 做移动设备的服务器端检测;为移动设备提供极其简化的 UI
  • 使用 CSS 媒体查询和功能检测等客户端技术(例如使用 Modernizr)进行渐进增强

长版本:

最重要的是要记住,尽管它们看起来很相似,但移动网络和桌面网络是不同的。我用街道和人行道之间的区别来进行类比。它们的制作目的大致相同——将人们从一个地点带到另一个地点。然而,它们是单独设计的,旨在供不同的运输方式使用。你可以在人行道上开车,也可以在街道中间行走,但这两种体验都不是最佳的。

长话短说,对于一个好的移动网站,您必须专门针对移动设备进行设计。这并不意味着您不能重用逻辑 - 您绝对应该重用。我只是说使用 JavaScript/CSS 隐藏一些元素不会将常规网站变成移动网站。

无论如何,我最近与一位同事就移动网络开发策略进行了演讲。它主要针对高等教育(大学校园)和我的校园(UCSB)中的移动网络,但许多策略和技术都广泛适用。有兴趣的人士可以在这里找到演示文稿和相关资源:https://it。 ucsb.edu/groups/wsg/mobile-web-brown-bag

资源

服务器端设备检测:

客户端功能支持检测/渐进增强:

随机资源

Short and sweet:

  • Read the W3C Mobile Web Application Best Practices
  • Separate your business/application logic and presentation logic as much as possible
  • Do server-side detection of mobile devices; serve an extremely simplified UI to mobile devices
  • Use client-side techniques like CSS media queries and feature detection (such as that done with Modernizr) to do progressive enhancement

The long version:

The most important thing to remember is that as similar as they appear, the mobile web and desktop web ARE different. The analogy I use the difference between a street and a sidewalk. Both of them are made for generally the same purpose - to get people from one location to another. However, they were designed separately and are intended for use by different modes of transport. You can drive a car on the sidewalk, and you can walk in the middle of the street, but neither experience will be optimal.

Long story short, for a good mobile site, you must design specifically for a mobile device. This doesn't mean you can't reuse logic - you definitely should. I'm just saying that using JavaScript/CSS to hide a few elements does not turn a regular site into a mobile site.

For what it's worth, I recently gave a presentation with one of my colleagues on mobile web development strategies. It is mostly targeted towards mobile web in higher education (college campuses) and my campus (UCSB), but many of the strategies and techniques are widely applicable. Interested parties can find the presentation and related resources here: https://it.ucsb.edu/groups/wsg/mobile-web-brown-bag

Resources

Server-Side Device Detection:

Client-Side Feature Support Detection / Progressive Enhancement:

Random Resources

知足的幸福 2024-11-06 13:26:17

首先,现在的移动并不一定意味着做 System.Web.Mobile 带来的事情,而是支持移动用例和移动设备的限制。或者,您想要精简应用程序以与移动用户相关,并且您想要执行诸如限制所需带宽、浏览器插件、繁重脚本编写和所需屏幕尺寸等操作。但实际上您不需要回到 WAP 等糟糕的旧时代。

First, these days mobile doesn't necessarily mean doing the things that System.Web.Mobile come, but rather supporting the mobile use case and the limitations of mobile devices. Or, you want to strip down your app to be relevent to mobile users, and you want to do things like limit bandwidth required, browser plugins, heavy scripting and screen size required. But you actually don't need to go back to the bad old days of WAP and such.

蝶…霜飞 2024-11-06 13:26:17

从我的阅读来看,前进的方向似乎是首先为移动设备进行设计,然后使用 @media CSS 自定义布局,以在功能更强大的设备中引入更多设计/功能概念。

http://www.smashingmagazine.com/2010/07/19/how-to-use-css3-media-queries-to-create-a-mobile-version-of-your-website/

http://www.slideshare.net/arborwebsolutions/practical -超越响应式网页设计

From my reading the way forward seems to be to design for mobile first and then customise the layout using @media CSS to introduce more design/functionality concepts in more capable devices.

http://www.smashingmagazine.com/2010/07/19/how-to-use-css3-media-queries-to-create-a-mobile-version-of-your-website/

http://www.slideshare.net/arborwebsolutions/practical-beyond-responsive-web-design

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文