Using Microsoft Asp.net to develop WAP website programs is more compatible with most mobile phones

Source: Internet
Author: User

Although Microsoft says that Asp.net can match various mobile phone devices, there are many mobile phone models, and the mobile phone information collected by Microsoft is limited. As a result, Asp.net may not match many mobile phones. In fact, HTML is generated only when HTML is supported, originally, only WML is supported, and HTML is missing to make the mobile phone unable to browse. We cannot wait for Microsoft to occasionally release a device update package-update Limited mobile phone device information. Here we can do it ourselves:

Asp.net identifies the device model by using machine. config or web. config to match the HTTP http_user_agent device ID. For more information, open the <browsercaps> section in machine. config.

The following is the detailed code of "Force WML to be generated on a specific mobile phone". In the <system. Web> section of Web. config, add the following code:

<Browsercaps>

<Resulttype = "system. Web. Mobile. mobilecapabilities, system. Web. Mobile, version = 1.0.5000.0, culture = neutral, publickeytoken = b03f5f7f11d50a3a"/>

<Usevar = "http_user_agent"/>

<Filter>

<Casematch = "SEC-SGHX458 | Motorola-T33">

Preferredrenderingtype = "wml11"

Preferredrenderingmime = "text/vnd. WAP. WML"

Preferredimagemime = "image/vnd. WAP. wbmp"

</Case>

</Filter>

</Browsercaps>

Code Description:

WML is forcibly generated here
Preferredrenderingtype = "wml11"
Preferredrenderingmime = "text/vnd. WAP. WML"
Preferredimagemime = "image/vnd. WAP. wbmp"

The most important thing is

<Casematch = "SEC-SGHX458 | Motorola-T33">

Here is the matching device, can refer to regular expression syntax, SEC-SGHX458 represents Samsung x458, Motorola-T33 represents motorcycle e360

Lead: http://hi.baidu.com/qiong_kaixin/blog/item/f6c2f28827e292bb0f2444a8.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.