It's easy to think about it. WAP is encoded with utf8. It seems that there are other WML and other similar materials. WML is used to check the information on the Internet. XML is also used quite a lot at ordinary times, WML is simple. C # can directly set the response code. It seems that there is a drama. Write a "Hello wife" first, // Set the contenttype type Response. contenttype = "text/vnd. WAP. WML "; // Set the Encoding Response. contentencoding = system. Text. encoding. utf8; // The following content is written according to 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 looky </P> \ r \ n "; Wapcontent + = "</card> \ r \ n "; Wapcontent + = "\ r \ n "; Wapcontent + = "</WML> \ r \ n "; Wapcontent + = "\ r \ n "; Response. Write (wapcontent ); Try it on your phone. OK The WAP program for writing novels. First from the next article on the Internet, there is a directory, 1.txt However, if the novel is too big, you must first have a directory. Press the 2 k page. Good guy, there are 200 pages. Forget it. Let's select a page number directly. Go: 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>! <Br/> \ n "; Wapcontent + = "</anchor> \ n "; All code: Private void page_load (Object sender, system. eventargs E) { String wapcontent; String MC; // Use the gb2312 simulator during 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) { // Display the Directory 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 each time MC = oreaderd. readtoend (); Oreaderd. Close (); Wapcontent + = "<card id = \" Lists "+ N. tostring () +" \ "> \ r \ n "; Int K = mc. Size/3000; Wapcontent + = "<p> directory </P> \ r \ n "; Wapcontent + = "<p> total:" + K. tostring () + "page </P> \ r \ n "; Wapcontent + = "<input name = \" SID \ "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 = \" $ SID \ "/> \ n "; Wapcontent + = "</go>! <Br/> \ n "; Wapcontent + = "</anchor> \ n "; Wapcontent + = "<onevent type = \" onenterbackward \ "> \ r \ n "; Wapcontent + = "<Prev/> \ r \ n "; Wapcontent + = "</onevent> \ r \ n "; Wapcontent + = "</card> \ r \ n "; Wapcontent + = "\ r \ n "; Wapcontent + = "</WML> \ r \ n "; Wapcontent + = "\ r \ n "; Response. Write (wapcontent ); Return; } Else N = system. Convert. toint32 (request ["page"]); Wapcontent = "<? XML version = \ "1.0 \"?> \ 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 of = new system. Io. fileinfo (request. physicalpath ); System. Io. streamreader oreader = new system. Io. streamreader (of. directoryname + "\" + "1.txt", system. Text. encoding. Default ); // Read 3000 words each time MC = oreader. readtoend (); Oreader. Close (); If (MC. size> 4000) { MC = mc. substring (n ); MC = mc. Replace ("\ r \ n", "<br/> "); Artmore = true; } // 3000 words per screen Wapcontent + = "<card id = \" Lists "+ N. tostring () +" \ "> \ r \ n "; Wapcontent + = "<do type = \" Accept \ "label = \" "+ (n-1). tostring () +" \ "> \ r \ n "; Wapcontent + = "<go href = \" WAP. aspx? Page = "+ (n-1). tostring () +" \ "/> \ r \ n "; Wapcontent + = "</DO> \ r \ n "; Wapcontent + = "<onevent type = \" onenterbackward \ "> \ r \ n "; Wapcontent + = "<Prev/> \ r \ n "; Wapcontent + = "</onevent> \ r \ n "; Wapcontent + = "<p> \ r \ n "; Wapcontent + = n. tostring () + "p "; Wapcontent + = MC; Wapcontent + = "</P> \ r \ n "; Wapcontent + = "<do type = \" Accept \ "label = \" Next Page \ "> \ r \ n "; Wapcontent + = "<go href = \" WAP. aspx? Page = "+ (n + 1). tostring () +" \ "/> \ r \ n "; Wapcontent + = "</DO> \ n "; // Select page Wapcontent + = "<input name = \" SID \ "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 = \" $ SID \ "/> \ n "; Wapcontent + = "</go>! <Br/> \ n "; Wapcontent + = "</anchor> \ n "; Wapcontent + = "</card> \ r \ n "; Wapcontent + = "\ r \ n "; Wapcontent + = "</WML> \ r \ n "; Wapcontent + = "\ r \ n "; Response. Write (wapcontent ); } Pick up your phone and try again at www.tjkx.com/wap.aspx !!! Debugging with a mobile phone is too troublesome. Download a winwap pro3.1 and debug it here. The tools are ready. It seems that C # is really good. It's easy to write a small program. |