如何在经典 asp 中使用 asp.net 网页 api?

How to consume a asp.net web api in classic asp?

我有一个示例网站 API 想在 asp 文件中使用它,请指导我在经典 asp 中使用网站 API 的步骤。

下面是 asp 代码。

  <%
  Dim Id
  Id = Request.QueryString("Id")

  url = "http://localhost:50464/api/values/"+Id

  Dim oXMLHttp
  Set oXMLHttp=Server.Createobject("MSXML2.ServerXMLHTTP.6.0")
  oXMLHttp.open "GET", url,false
  oXMLHttp.setRequestHeader "Content-Type", "application/json"
  oXMLHttp.send 
  response.write oXMLHttp.responseText
  Set oXMLHttp = Nothing
  %>

API url: http://localhost:50464/api/values