<% @ Page language = "c #" autoeventwireup = "true" debug = "true" validaterequest = "false"%>
Void Page_Load (Object Sender, Eventargs E) {
IF (! page.ispostback) {
Response.Write ( "have not entered any characters
!");
}
Else {
Label_1.text = "";
Label_2.text = ""
Label_0.Text = Convert.TOString ((TextBox_1.text) ;length);
// ASCII coding output
ByTefunction (TextBox_1.text);
// character code output
Charfunction (TextBox_1.text);
// HTML code output
HTMLFunction (TextBox_1.text);
}
}
// ASCII encoded output function
Void Bytefunction (String Str) {
Byte [] mybytes = system.text.Encoding.ascii.getbytes (STR);
For (int i = 0; i Label_2.text = Convert.TOString (MyBytes [i]) "" } } // character code output function Void Charfunction (String Str) { Byte [] mybytes = system.text.Encoding.ascii.getbytes (STR); Char [] mychars = system.text.encoding.ascii.getchars (mybytes); //Label_2.text=new string (mychars); For (int i = 0; i Label_1.text = Convert.TOString (MyChars [i]) "" } } // HTML encoded output function Void HTMLFunction (String Str) { String str_html = (Server.htmlencode (STR)); Label_3.text = STR_HTML; Label_4.text = server.htmlencode (STR_HTML); } Script> Please enter a string: form> The string length you entered: The character code is: HTML encoding is: HTML encoding is output by character:
ASCII code encoding: