我正在尝试在VB中的一个类中的方法中实现以下内容但是会出现构建错误:
Public Sub sendMessage()
Dim sUrl As String
Dim sAPI_ID, sPassword, sUsername, sMobileNo, sText As String
Dim oXMLHTTP, sPostData, sResult
sUrl = "http://api.clickatell.com/http/sendmsg"
sAPI_ID = "xxxx"
sPassword = "xxxx"
sUsername = "xxxx"
sMobileNo = "xxxx"
sText = "This is an example message"
sPostData = "api_id=" & sAPI_ID
sPostData = sPostData & "&user=" & sUsername
sPostData = sPostData & "&password=" & sPassword
sPostData = sPostData & "&to=" & sMobileNo
sPostData = sPostData & "&text=" & sText
oXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
oXMLHTTP.Open("POST", sUrl, False)
oXMLHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
oXMLHTTP.Send(sPostData)
sResult = oXMLHTTP.responseText
oXMLHTTP = Nothing
Response.Write(sResult)
End Sub
以下两行标有下划线,我认为缺少进口:
oXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
和
Response.Write(sResult)
有人能告诉我我需要输入什么或丢失什么?
答案 0 :(得分:2)
这些内置在旧ASP中的COM对象中:
http://msdn.microsoft.com/en-us/library/ms524716(v=vs.90).aspx
正如您在MSDN页面上看到的那样,在ASP.NET中,System.Web
命名空间中有新的类提供了相同的功能。有关.NET中新类的更多信息,请访问:
http://msdn.microsoft.com/en-us/library/x6w6xys5(v=VS.71).aspx