网络为移动设备 - 对于ASP.NET最佳实践 [英] Web for mobile devices - best practices for ASP.NET

查看:231
本文介绍了网络为移动设备 - 对于ASP.NET最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

开始构建的移动设备(任何电话)的Web应用程序。

什么是使用ASP.NET 3.5 / ASP.NET 4.0和C#的最佳方法?

Starting to build web applications for mobile devices (any phone).
What would be the best approach using ASP.NET 3.5/ASP.NET 4.0 and C#?

UPDATE(feb2010)
$ B采用windows $ B的任何消息移动7?

UPDATE (feb2010)
Any news using windows mobile 7?

推荐答案

这取决于如果你真的想为支持所有手机或只有高端的或新的手机像iPhone这没有太多的限制,渲染网页。如果你能够问真正的 HTML渲染,Javascript和cookie支持手机上的要求,然后真正的约束是屏幕的尺寸有限。你应该做的罚款与ASP.NET中的正常web开发照顾到页面的大小。

It depends if you really want to support every cell phone or only high end or new phone like the iPhone which don't have many limitations rendering web pages. If you could ask for real HTML rendering, Javascript and cookies support on the phone as requirement, then the real constraint is the limited size of the screen. You should do fine with "normal" web development in ASP.NET taking care to the the size of the pages.

如果是这样的话,的你可以停止阅读这里。

如果您真的要支持每个手机,尤其是旧的,你应该知道,有不同类型的手机。他们中许多人的限制和约束显示网页。他们中的一些可以使用JavaScript,但很多人不知道。他们中的一些可以显示HTML内容,但许多人不能。他们必须依靠访问Web无线标记语言标准。因此,它是不容易构建一个支持所有这些不同的设备的一个网站。

If you really want to support every cell phone, especially old ones, you should be aware that there are different types of phones. Many of them have limitations and constraints showing web pages. Some of them can use JavaScript, but many of them do not. Some of them can display HTML content, but many others can not. They have to rely on the "Wireless Markup Language" standard for accessing web. So, it's not easy to build a website that supports all of these different devices.

下面是一些链接,一般的内容(不ASP.NET特定的),这将有助于让整个画面:

Here are some links to general content (not ASP.NET specific), which could help getting the whole picture:

  • Mobile Web Best Practices 1.0 (W3C)
  • Mobile Web Developer#s Guide (dotMobi)

他们主要局限性但是,正如我前面提到的,较小的屏幕比普通PC的。和很多手机不支持JavaScript,饼干,有的甚至不显示图像。

Their main limitation however is, as I already mentioned, the smaller screen than on normal PC's. And many cell phones do not support JavaScript, Cookies and some even don't show images.

有用于手机特殊标记的标准。 WML页面是例如,对于一个手机广泛采用的标准。 WML表示其是基于XML的无线标记语言。你可以找到w3schools.com 的描述,这里WML 的参考。

There are special markup standards for cell phones. WML pages is for example a widely adopted standard for cellphones. WML stands for "Wireless Markup Language" which is based on XML. You can find a description and reference of WML here on w3schools.com.

下面的代码显示了一个示例WML页面:

The code below shows a sample WML page:

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
   "http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>
   <card id="card1" title="Stackoverflow">
      <do type="accept" label="Menu">
         <go href="#card2"/>
      </do>
      <p>
         <select name="name"> 
            <option value="Questions">Questions</option>
            <option value="MyAccount">My account</option>
            <option value="FAQ">FAQ</option>
         </select>
      </p>
   </card>
   <card id="card2" title="Menu">
      <p>
           You selected: $(name)
      </p>
   </card>
</wml>



好消息是,ASP.NET将呈现WML(和其他移动标记标准)自动内容。你不必写WML文件自己。内置的机制检测设备(手机)的Web请求的类型。然而,在ASP.NET移动设备检测不正确的某些(更新)的设备。看看 WURFL ,一个XML配置文件,其中包含有关功能和许多移动设备功能的信息。

The good news is, that ASP.NET renders WML (and other mobile markup standards) content automatically. You don't have to write WML files yourself. A built-in mechanism detects the type of device (cell phone) of the web requests. However, mobile device detection on ASP.NET does not work correctly for some (newer) devices. Take a look at WURFL, an XML configuration file which contains information about capabilities and features of many mobile devices.

您可以测试你的ASP.NET中的一个标准的Web浏览器开发的网页,但它不会给个你开发什么右图。有一些模拟器可供这个问题,这模拟手机桌面计算机上。有一个 Microsoft支持文章这也解释了,你可以下载它们。

You can test the pages you develop in ASP.NET in a standard web browser, but it would not give th right picture of what you have developed. There are some emulators available for this problem, which simulate a cell phone on your desktop computer. There is a Microsoft support article which explains where you can download them.

在ASP.NET移动控件,以前的已知,为微软移动互联网工具包扩展.NET框架和Visual Studio通过启用ASP.NET提供的标记到各种移动设备构建移动Web应用程序。

The ASP.NET Mobile Controls, formerly knowns as the "Microsoft Mobile Internet Toolkit" extend the .NET Framework and Visual Studio to build mobile Web applications by enabling ASP.NET to deliver markup to a wide variety of mobile devices.

在ASP.NET移动控件呈现适当的标记(HTML 3.2,WML 1.1,cHTML等,XHTML)同时处理不同的屏幕大小,方向和设备功能。

The ASP.NET mobile controls render the appropriate markup (HTML 3.2, WML 1.1, cHTML, XHTML) while dealing with different screen sizes, orientations and device capabilities.

在这里学到的官方网站更多

Learn more here on the official web site.

这篇关于网络为移动设备 - 对于ASP.NET最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆