Common ASP + WML problems in WAP
There is a default email mechanism in HTML: "mailto :". However, e-mails must be implemented through the WML form. For example:
<WML>
<Card id = "edit" Title = "email editor">
<P> from: <input type = "text" name = "from" format = "* m"/> </P>
<P> to: <input type = "text" name = "to" format = "* m"/> </P>
<P> subject: <input type = "text" name = "subject" format = "* m"/> </P>
<P> Message Body: <input type = "text" name = "body" format = "* m"/> </P>
<P>
<Anchor> send this mail
<Go method = "Post" href = "http://some.host/mailhandler "? Action = Send/">
<Postfield name = "from" value = "$ (from)"/>
<Postfield name = "to" value = "$ (to)"/>
<Postfield name = "subject" value = "$ (subject)"/>
<Postfield name = "body" value = "$ (body)"/>
</Go>
</Anchor>
</P>
</Card>
</WML>
In the code.
To use a process similar to sending a mail, you need to edit the variable name. In addition, the sent data is limited, and long information may need to be interrupted.
Do developers need a WAP Gateway?
Not necessary. If you only want to implement simple WAP content service, you can use the existing web server (only you need to modify the MIME type ). The mobile phone will connect to your server through a local gateway.
However, there are many benefits to resident the Developer Program on the gateway. Since the developer's program is a part of the gateway, the developer can know the call number, identity, location, and so on.
5. Can I see the source code of WML?
If you use the SDK to view the WML code. If there is only one HTML browser, you can access the "Fetch page" Service (http://www.webcab.de) to get the code. This can be displayed on any WML page on the Internet.
27. How to Prevent WML pages from being read from the cache?
<%
Response. contenttype = "text/vnd. WAP. WML"
Response. expires =-1
Response. addheader "Pragma", "No-Cache"
Response. addheader "cache-control", "No-cache, must-revalidate"
%>
The example of using Meta expires after 86400 seconds (24 hours:
<? XML version = "1.0"?>
<! Doctype WML public "-// wapforum // dtd wml 1.1 // en"
Http://www.wapforum.org/DTD/wml_1.1.xml>
<WML>
<Head>
<Meta forua = "true" http-equiv = "cache-control" content = "Max-age = 86400"/>
</Head>
<Card id = "expire1day">
<P> this card will live in the cache for a day </P>
</Card>
</WML>
The user's mobile phone number and mobile phone model are included in the HTTP header, as described below.
(1) User's mobile phone number
(2) Mobile Phone Model
The SP/CP must be approved by the Telecommunications Department.
How do I use a WAP device to send an email?
There is a default email mechanism in HTML: "mailto :". However, e-mails must be implemented through the WML form. For example:
<WML>
<Card id = "edit" Title = "email editor">
<P> from: <input type = "text" name = "from" format = "* m"/> </P>
<P> to: <input type = "text" name = "to" format = "* m"/> </P>
<P> subject: <input type = "text" name = "subject" format = "* m"/> </P>
<P> Message Body: <input type = "text" name = "body" format = "* m"/> </P>
<P>
<Anchor> send this mail
<Go method = "Post" href = "http://some.host/mailhandler "? Action = Send/">
<Postfield name = "from" value = "$ (from)"/>
<Postfield name = "to" value = "$ (to)"/>
<Postfield name = "subject" value = "$ (subject)"/>
<Postfield name = "body" value = "$ (body)"/>
</Go>
</Anchor>
</P>
</Card>
</WML>
How can I know whether the request is from a WML Browser or an HTML browser?
Obtain the http_accept value and determine whether it is "Vnd. WAP. WML"
<%
Response. Buffer = true
Dim iswap
Httpaccept = lcase (request. servervariables ("http_accept "))
If instr (httpaccept, "WAP") then
Iswap = 1
Else response. Redirect "/index.html": Response. Flush: Response. End
End if
%>
<% Response. contenttype = "text/vnd. WAP. WML" %> <? XML version = "1.0"?>
<% Response. Flush %>
<! Doctype WML public "-// wapforum // dtd wml 1.1 // en"
Http://www.wapforum.org/DTD/wml_1.1.xml>
<WML>
<Card id = "Redirect">
<Onevent type = "onenterforward">
<Go href = "/index. WML"/>
</Onevent>
<P>
<A href = "/index. WML"> enter </a>
</P>
</Card>
</WML>
<% Response. Flush: Response. End %>
How can I determine the browser or mobile phone number of a visitor?
You can check the http_user_agent label. For example, when you try to access a site using Microsoft Internet Explorer, http_user_agent will return: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98 ); in the same case, if you use Nokia 7110 to access this site, http_user_agent will be: nokia7110/1.0 (04.73 ). Based on this, you can determine the type of user proxy.
2. Call the phone number directly on the WAP page
Place the following code between <p> </P>.
<Input name = "phone_no" format = "* m" value = "13"/>
<Do type = "option" label = "outbound call">
<Go href = "wtai: // WP/MC; $ (phone_no)"/>
</DO> <br/>
Or you can write the phone number directly:
<A href = "wtai: // WP/MC; 1331597312 *"> call </a>
3. asp gb2312 to UTF-8 Program
Paste the following code into an ASP + WML file.
<%
Function uni (Chinese)
For I = 1 to Len (Chinese)
A = mid (Chinese, I, 1)
Uni = uni & "& # X" & hex (ASCW ())&";"
Next
End Function
%>
Usage:
<A Title = "<% = uni (" OK ") %>" href = "http://www.51omeng.com/bicyle/bikewap/index.asp"> <% = uni ("Welcome to be loved ") %> </a> <br/>
<Do type = "Prev" name = "Prev" label = "back"> <Prev/> </DO>
My WAP development experience
1. Incorrect connection
Response. Write "<a href = 'HTTP: // m2p.cn/txl.asp? Mobileno = "& mobilenum &" & file = "& file &" '> address book </a>"
& Replace &
Response. Write "<a href = 'HTTP: // m2p.cn/txl.asp? Export Eno = "& export Eno &" & page = "& s2-1 &" & file = "& file &" '> previous page </a>"
2. Chinese characters cannot be passed and must be encoded.
''Uses the urlencode Method for encoding
Strurlencode = server. urlencode (STR) // retrieves Chinese Characters
Example: response. Write "<a href = 'HTTP: // m2p.cn/kjj.asp? Mobileno = "& mobileno &" & host = "& host &" & comm = "& server. urlencode (mid (V (2 * I + 1), 1, J-1) & "'>" & Mid (V (2 * I + 1), J + 1, len (V (2 * I + 1)-j) & "</a>"
''Encoding using the htmlencode Method
Strhtmlencode = server. htmlencode (STR)
Call
<A href = '"&" wtai: // WP/MC; "& Mid (V (2 * I + 1), 1, J-1) & "'>" & Mid (V (2 * I + 1), J + 1, Len (V (2 * I + 1)-j) & "</a>"
3. the WAP does not save the cashe, and is forced to refresh.
<Meta http-equiv = "cache-control" content = "Max-age = 0"/>
<Meta http-equiv = "cache-control" content = "no-Cache"/>
5. click the button to add the connection
<Do type = "options" label = "">
<Go href = "http://wap.un165.com/"/>
</DO>
4. Common Errors
Message for the m3gate command
Fatal error. ln 10. Col 10
Expected end of tag 'P'
Response. Write "Command executed </BR>"
Correct writing
Response. Write "Command executed"
Response. Write "<br/>"
5. Repeat operations on the same connection WAP
The text needs to be turned over, because the connections passed by each click on the next page are the same
Do not perform repeated operations on mobile phones
Solution: Add a dynamic parameter & time = now.
6. Automatic line feed for WAP
<P mode = 'nowrap '> force the system to stop automatically wrapping
Auto refresh
<Card id = "C1" ontimer = "# C1">
<Timer value = "20"/>
<P align = "center">
Test card1
</P>
</Card>
Right return soft key
<Do type = "options" label = "return" name = "home">
<Spawn href = "XXX. WML">
</DO>
Use the WAP page to directly call the phone number
2. Call the phone number directly on the WAP page
Place the following code between <p> </P>.
<Input name = "phone_no" format = "* m" value = "13"/>
<Do type = "option" label = "outbound call">
<Go href = "wtai: // WP/MC; $ (phone_no)"/>
</DO> <br/>
Or you can write the phone number directly:
<A href = "wtai: // WP/MC; 1331597312 *"> call </a>
3. asp gb2312 to UTF-8 Program
Paste the following code into an ASP + WML file.
<%
Function uni (Chinese)
For I = 1 to Len (Chinese)
A = mid (Chinese, I, 1)
Uni = uni & "& # X" & hex (ASCW ())&";"
Next
End Function
%>
Usage:
<A Title = "<% = uni (" OK ") %>" href = "http://www.51omeng.com/bicyle/bikewap/index.asp"> <% = uni ("Welcome to be loved ") %> </a> <br/>
WAP Server Configuration
Text/vnd. WAP. WML image/vnd. WAP. wbmp
Text/vnd. WAP. WMLS
Application/vnd. WAP. wmlc
Application/vnd. WAP. wmlscriptc wmlsc
Text/vnd. WAP. WMLScript WSC
Text/vnd. WAP. WMLScript
OTA Configuration
Application/Java-archive jar
Text/vnd. Sun. J2. app-Descriptor Jad
Obtain WML source code
Http://webcab.de/fetchpage.htm