Although Microsoft said that asp.net can match various mobile phone devices, there are many mobile phone models and the mobile phone data collected by Microsoft is limited. Therefore, asp.net mismatches many mobile phones. It can support html but generates html. It only supports wml. , the missing HTML is generated and the mobile phone cannot 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 relying on machine.config or web .config matches the http protocol HTTP_USER_AGENT device flag. For details, you can open the <browserCaps> section in machine.config to see.
The following is the detailed code for "Forcing a specific mobile phone to generate WML". Add the following code to the <system.web> section in web.config:
<browserCaps>
<result type="System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<use var="HTTP_USER_AGENT" />
<filter>
<case match="SEC-SGHX458|Motorola-T33">
preferredRenderingType = "wml11"
preferredRenderingMime = "text/vnd.wap.wml"
preferredImageMime ="image/vnd.wap.wbmp"
</case>
</filter>
< /browserCaps>
Code description:
wml is forced to be generated here
preferredRenderingType = "wml11"
preferredRenderingMime = "text/vnd.wap.wml"
The most important thing about
preferredImageMime="image/vnd.wap.wbmp"
is<case match="SEC-SGHX458|Motorola-T33">
Here is matching device, you can refer to the regular expression syntax, SEC-SGHX458 represents Samsung X458, Motorola- T33 stands for Motorcycle e360