Idea: Simulate data submission, analyze and send back data, and extract results.
Let's first look at this website,
Http://www.developerfusion.com/tools/convert/csharp-to-vb/ [convertor]
Open the [convertor] site and use firebug or httpwatch to analyze the post data. refer to the following for details.Code:
Automaticclipboard = ture & automaticclipboard = false & code =" +Code
The previous line of code is very important to simulate data submission,
Streamreader responsestream= NewStreamreader (request. getresponse (). getresponsestream ());
The purpose of this line of code is to get the data to be sent back. Well, I will not talk about anything else. paste the Code:
Convertor
<% @ Page Language = " C # " Validaterequest = " False " %>
<% @ Import namespace = " System. net " %>
<% @ Import namespace = " System. Io " %>
<! Doctype HTML public " -// W3C // dtd xhtml 1.0 transitional // en " " Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >
< Script runat = " Server " >
Protected Void Btnconvert_click ( Object Sender, eventargs E)
{
String URL = " Http://www.developerfusion.com/tools/convert/csharp-to-vb/ " ;
Webrequest request = Httpwebrequest. Create (URL );
Request. Method = " Post " ;
String Code = Txtcode. Text. Trim ();
Request. contenttype = " Application/X-WWW-form-urlencoded " ;
String Posteddata = " Automaticclipboard = ture & automaticclipboard = false & code = " + Code;
Byte [] Requestcontent = System. Text. encoding. ASCII. getbytes (posteddata );
Request. contentlength = Requestcontent. length;
Stream requeststream = Request. getrequeststream ();
Requeststream. Write (requestcontent, 0 , Requestcontent. Length );
// Read the response;
Streamreader responsestream = New Streamreader (request. getresponse (). getresponsestream ());
String Response = Responsestream. readtoend ();
Responsestream. Close ();
Int Firstdiv = Response. indexof ( " <Ul " , Response. indexof ( " Code-View " ));
Int Lastdiv = Response. indexof ( " </Ul> " , Firstdiv );
String Result = Response. substring (firstdiv, lastdiv - Firstdiv );
Ltlresult. Text = Result;
}
</Script>
< HTML xmlns = " Http://www.w3.org/1999/xhtml " >
< Head runat = " Server " >
< Title > </ Title >
</ Head >
< Body >
< Form ID = " Form1 " Runat = " Server " >
< Div >
< ASP: textbox ID = " Txtcode " Runat = " Server " Height = " 204px " Textmode = " Multiline " Width = " 586px " > </ ASP: textbox >
< BR />
< ASP: button ID = " Btnconvert " Runat = " Server " Onclick = " Btnconvert_click " Text = " Convert " />
< BR />
< ASP: literal ID = " Ltlresult " Runat = " Server " > </ ASP: literal >
</ Div >
</ Form >
</ Body >
</ Html >
Of course, there are a lot of C # and VB. NET conversion tools on the Internet:
HTTP: // Labs. Converged fusion. co. uk/convert/csharp-to-vb.aspx
HTTP: // Www.codechanger.com/
HTTP: // Www.dotnetspider.com/convert/vb-to-csharp.aspx
HTTP: // Www.kamalpatel.net/
HTTP: // Csharpconverter.claritycon.com
HTTP: // Www.ragingsmurf.com/
HTTP: // Aspalliance.com/
HTTP: // Developerfusion.com/
Www.icsharpcode.com
HTTP: // Bytes
Of course you can tell me if you have a better way. Thank you!