GPRS internet access, as if a lot of content is paid, only download ringtones, what images, boring! It is best to use a mobile phone to read novels. There seems to be no free WAP novels on the Internet. The Office's younger sister also wants to read novels on the mobile phone. It seems that only one novel can be made by herself.
Java is a powerful tool for WAP development. However, it is really troublesome for WAP to transfer this "code" to that "code". Forget it and check whether C # can be used as a WAP small site.
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 //"/"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 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 //"/"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 //"/"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 );
}