将MSXML2.ServerXMLHTTP调用从经典ASP转换为ASP.New网页(Razor)

时间:2014-07-10 23:31:12

标签: asp.net razor vbscript asp.net-webpages

我有一个经典的asp应用程序,它使用MSXML2.ServerXMLHTTP通过查询字符串将数据传递给API,并读取\处理响应。我正在测试ASP.Net网页(这不是MVC 4)并尝试移植它,但不知道如何。

这是原始经典asp(vbscript)代码的一个子集:

PostData = "variable1=test"
PostData = PostData & "variable2=test"

'Send the transaction info as part of the querystring
Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")

xml.open "POST", "https://www.domain.com/api/file.aspx?" & PostData & "", false
xml.send ""
strStatus = xml.Status
strRetval = xml.responseText
set xml = nothing

Results = split(strRetVal, ",", -1)
responseCode                = Results (0)
responseReasonCode          = Results (1)
responseId                  = Results (2)

If (responseCode = 1) then
    newID = responseId
END IF

如何使用ASP.Net网页完成此操作?请记住,网页不同但与MVC(http://www.asp.net/web-pages)类似。

1 个答案:

答案 0 :(得分:0)

Asp.NetAsp.net:)

WebPages实际上更类似于传统的ASP 风格而不是MVC:)

... H个