Wap asp. NET development notes (1)

Source: Internet
Author: User

Wap asp. NET development notes (1)

After IIS is configured, an Asp.net mobile project is created, and a ing entry about WML mime is added, it is thought that the project can be tested, so m1_ate is started, but it fails, location Information:
The error of the UTF-8 format not supported class, so check the Web. config.
<Globalization
Requestencoding = "UTF-8"
Responseencoding = "UTF-8"
/>
Change
<Globalization
Requestencoding = "gb2312"
Responseencoding = "gb2312"
/>
Once again I started IE and the test passed, but mshortate again reported the following error:
Text/html format is not supported.

Think, why does mshortate get a response in HTML format instead of WML? Read the information and use the WAP framework of Asp.net to find out how to explain the execution result of Asp.net through the configuration file, this execution may be interpreted as HTML or WML, depending on whether the device matches. How is device matching implemented? Mainly through the machine. Cong file or the web. config file
In the <browsercaps> section, use http_user_agent to obtain the device identifier, but the framework obtains some parameters of the device to obtain the appropriate WML file under the Framework configuration.
Mshortate is not a standard mobile device, so the framework does not know it. By default, it is output according to the HTML device, resulting in the above error.
Solution: Let the framework know that mreceivate is a device.

Search for machine. config and copy one of them to 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 = "mshortate/0.6">
Type = "Ericsson R380"
Version =$ {browsermajorversion}. $ {browserminorversion}
Majorversion =$ {browsermajorversion}
Minorversion =$ {browserminorversion}
Preferredrenderingtype = "wml11"
Preferredrenderingmime = "text/vnd. WAP. WML"
Preferredimagemime = "image/vnd. WAP. wbmp"
Inputtype = "virtualkeyboard"
Caninitiatevoicecall = "true"
Mobiledevicemanufacturer = "Ericsson"
Mobiledevicemodel = "R380"
Screenpixels elswidth = "310"
Screenpixelsheight = "100"
Screencharactersheight = "7"
Screenbitdepth = "1"
Iscolor = "false"
Maximumrenderedpagesize = "3000"
Ismobiledevice = "true"
</Case>

</Filter>

</Browsercaps>

In addition to the "mshortate", all others are copied, tested, and run. OK.
So how do I know it's m1_ate/0.6? I created a log file and recorded it in the page_load event. I obtained the user_aagent of m1_ate for my test through the file record. The Code is as follows:

Private void _ loghttpheader ()
{
Filestream FS = new filestream ("F: // wutemp // log. log", filemode. openorcreate, fileaccess. Write );
Streamwriter Ws = new streamwriter (FS );
WS. writeline (datetime. Now. tow.timestring () + request. useragent + "" + request. useragent );
WS. Flush ();
WS. Close ();

}

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.