简体   繁体   English

将经典ASP转换为ASP.NET C#

[英]convert classic ASP to ASP.NET C#

<%
       Dim xmlDoc; 
Dim objNodeList;
Dim count;

set xmlDoc = Server.CreateObject("Msxml2.DOMDocument.6.0");

xmlDoc.validateOnParse = False;
xmlDoc.async = False;

xmlDoc.loadXML("<div>" & Request.Form("inTransContent")   & "</div>");

Else
      Set objNodeList = xmlDoc.documentElement.selectNodes("//text()");
      count = objNodeList.length;

      For i = 1 To count 
           objNodeList(i-1).insertData 0, "XYZ " ;
           objNodeList(i-1).insertData objNodeList(i-1).length, " XYZ" ;
      Next 

      Response.Write(xmlDoc.documentElement.xml);
End If

%>

Hi, I need to convert this code to C# and I'm not that familiar with vbscript!! 嗨,我需要将此代码转换为C# ,我对vbscript并不熟悉!

Kindly can anyone convert this code!! 请允许任何人转换此代码!

Thanks 谢谢

Look here!!! 看这里!!! (An SO question asking how to call native routines from managed) (一个SO问题,询问如何从托管中调用本机例程)

And here!!! 和这里!!! (An online utility for converting between different .NET languages) (用于在不同.NET语言之间进行转换的在线实用程序

One of the wonderful things in .NET is that you can write it using different languages. .NET一个很棒的东西是你可以用不同的语言编写它。

One of those is VB.NET that should be backward compatible enough to support your code, and even if not then converting classic ASP to VB.NET should be easy as the syntax is the same. 其中一个是VB.NET ,它应该向后兼容足以支持你的代码,即使没有,然后将经典ASP转换为VB.NET应该很容易,因为语法是相同的。

So just change the project to VB.NET instead of C# and you're good to go. 所以只需将项目更改为VB.NET而不是C# ,你就可以了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM