将server.createobject从经典ASP转换为ASP.NET

时间:2014-01-18 07:18:29

标签: asp.net vb.net vbscript asp-classic

您好我有一个在ASP经典中创建的功能,并希望转换ASP.NET Vb中的功能。下面是在Classic ASP中使用的代码

Function chargeIt(CARD_NUM, EX_MONTH, EX_YEAR, AMOUNT, COMMENT)    
url = "https://secure.authorize.net/gateway/transact.dll"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") 
xmlhttp.open "POST", url, false 
xmlhttp.send "x_description=""Violation Payment For "&COMMENT&"""&x_Version=3.1&x_Delim_Data=True&x_Login=xnxx&x_Tran_Key= 9&x_Amount="&amount&"&x_Card_Num="&card_num&"&x_Exp_Date="&ex_month&ex_year&"&x_Type=AUTH_CAPTURE"
    Dim arrContents(150,0)

    contents=split(xmlhttp.responseText,",")
    'response.write(xmlhttp.responseText)
    i=0
    for each value in contents
    arrContents(i,0)=value
    i=i+1
    next
    SELECT CASE arrContents(0,0)
    CASE "1"
        status="Approved"
    END SELECT

    chargeIt=status
end function

1 个答案:

答案 0 :(得分:0)

您可以使用System.Net.WebRequest类。它是.NET Framework的一部分。

例如:

Dim strURL
Dim objXML As WebRequest
Dim strResponse As WebResponse

objXML = WebRequest.Create(strURL)
strResponse = objXML.GetResponse()

objXML = Nothing
strResponse.Close()

Google on WebRequest VB.NET,你应该能够开始......