The program usually work and so on girlfriend always have to wait a long time, want to read and have no belt, only play mobile phone games, GPRS internet, as if a lot of content is to pay, just download ringtones, what pictures, boring! It is best to use mobile phone to read novels, the network is not like a free WAP novel, the Office of the younger sister also want to use mobile phone to read novels, it seems that only their own to do one.
All say Java is the development of WAP, but WAP need this "code" to go to that "code", really trouble, forget, see if you can do a WAP station with C #.
It's easy to come by, WAP is using UTF8 code, as if there is any WML and so on, WML search data on the Internet, and XML is similar to the usual use of XML is quite a lot, WML is simple, C # directly can be set response coding, it seems to have a chance, first write a " Hello Wife "Bar,
Set ContentType type
Response.contenttype= "TEXT/VND.WAP.WML";
Set encoding
Response.contentencoding=system.text.encoding.utf8;
The following is part of the content written under the WML protocol
wapcontent= "<?xml version=\" 1.0\ "encoding=\" utf8\ ">\r\n";
wapcontent+= "<! DOCTYPE WML public \ "-//wapforum//dtd WML 1.1//en\" \ "http://www.wapforum.org/dtd/wml_1.1.xml\" ><wml>\r\n ";
wapcontent+= "\ r \ n";
wapcontent+= "<card id=\" hello\ ">\r\n";
wapcontent+= "<p>hello wife </p>\r\n";
wapcontent+= "</card>\r\n";
wapcontent+= "\ r \ n";
wapcontent+= "</wml>\r\n";
wapcontent+= "\ r \ n";
Response.Write (wapcontent);
Try it with your cell phone, OK.
Now write a novel WAP program.
First from the online next novel, the existence of a directory, 1.txt
But the novel is too big, must first have a table of contents, press 2K paging bar, good boy, there are 200 pages, forget, to a direct selection of the Go bar:
wapcontent+= "<input name=\ pagenum\" size=\ "3\" maxlength=\ "10\" type=\ "text\" format=\ "*N\" emptyok=\ "true\"/ > ";
wapcontent+= "<anchor title=\" login\ ">\n";
wapcontent+= "<go href=\" wap.aspx\ "method=\" get\ ">\n";
wapcontent+= "<postfield name=\" page\ "value=\" $PAGENUM \ "/>\n";
wapcontent+= "</go> See this page!<br/>\n";
wapcontent+= "</anchor>\n";
All the code:
private void Page_Load (object sender, System.EventArgs e)
{
String wapcontent;
String MC;
Using the GB2312 simulator when debugging
Response.contenttype= "TEXT/VND.WAP.WML";
Response.contenttype= "Text/vnd.wap.wml;charset=utf-8";
response.contentencoding=system.text.encoding.utf8;//Unicode;//"UTF8";
Response.contentencoding=system.text.encoding.getencoding ("GB2312");
int n=0;
if (request["Page"]==null)
{
Show Table of Contents
wapcontent= "<?xml version=\" 1.0\ "encoding=\" utf8\ ">\r\n";
wapcontent= "<?xml version=\" 1.0\ "encoding=\" gb2312\ ">\r\n";
wapcontent+= "<! DOCTYPE WML public \ "-//wapforum//dtd WML 1.1//en\" \ "http://www.wapforum.org/dtd/wml_1.1.xml\" ><wml>\r\n ";
wapcontent+= "\ r \ n";
System.IO.FileInfo ofm=new System.IO.FileInfo (Request.PhysicalPath);
System.IO.StreamReader oreaderd=new System.IO.StreamReader (ofm.directoryname + "\" + "1.txt") System.Text.Encoding.Default);
Read 3000 words at a time
wapcontent+= "</wml>\r\n";
wapcontent+= "\ r \ n";
Response.Write (wapcontent);
}
Pick up the phone, www.tjkx.com/wap.aspx, try it, cool!!!
Use the phone to debug too much trouble, download a Winwap Pro3.1 in here to debug.
The tools are ready, it seems that C # is very good, write a small program is so simple
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.