[Original] Turn C # to VB and C # to VB [Source Code]

Source: Internet
Author: User

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!

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.