01-31-2005 06:53 PM - edited 03-13-2019 07:51 AM
I need to convert the pushphone2 funtion from
JavaScript in ASP into VB in ASP.NET.
Following is the converted code, but when I run it
with clicking the Send button in my web applicaiton,
the IP Phone just reset. Does anyone can help me
what is wrong?
With the Ethereal tool, I found the request had been
sent to the IP Phone. Just after the authentication,
which was OK, the phone was reset.
===================================================
Imports MSXML2
Function phonePush2(ByVal phoneIP As String, ByVal URI1 As String, ByVal URI2 As String, ByVal userID As String, ByVal password As String)
Dim authstring As String = text2base64(userID + ":" + password)
Dim xmlhttp As New MSXML2.XMLHTTP
Dim xmlDoc As New MSXML2.DOMDocument
Dim pushxml As String = "<CiscoIPPhoneExecute><ExecuteItem Priority=" + Chr(34) + "0" + Chr(34) + " URL=" + Chr(34) + URI1 + Chr(34) + "/><ExecuteItem Priority=" + Chr(34) + "0" + Chr(34) + " URL=" + Chr(34) + URI2 + Chr(34) + "/></CiscoIPPhoneExecute>"
If (xmlDoc.loadXML(pushxml)) Then
xmlhttp.open("POST", "http://" + phoneIP
+ "/CGI/Execute", False)
xmlhttp.setRequestHeader("Authorization",
"Basic " + authstring)
xmlhttp.setRequestHeader("Connection", "close")
xmlhttp.setRequestHeader("Content-type",
"application/x-www-form-urlencoded")
xmlhttp.send(xmlDoc.xml)
Else
Response.Write(xmlDoc.parseError.reason)
End If
xmlhttp = Nothing
xmlDoc = Nothing
End Function
=====================================================
02-01-2005 06:58 PM
Problem solved with following code:
=====================================================
Imports MSXML2
Function phonePush2(ByVal phoneIP As String, ByVal URI1 As String, ByVal URI2 As String, ByVal userID As String, ByVal password As String)
Dim authstring As String = text2base64(userID + ":" + password)
Dim xmlhttp As New MSXML2.XMLHTTP
Dim pushxml As String = "
pushxml = "XML="+Server.UrlEncode(pushxml)
xmlhttp.open("POST", "http://" + phoneIP
+ "/CGI/Execute", False)
xmlhttp.setRequestHeader("Authorization",
"Basic " + authstring)
xmlhttp.setRequestHeader("Connection", "close")
xmlhttp.setRequestHeader("Content-type",
"application/x-www-form-urlencoded")
xmlhttp.send(pushxml)
xmlhttp = Nothing
End Function
=====================================================
11-09-2005 08:10 PM
hi,
Just like you, I successfully run push2phone in asp and now trying to convert in .net but encountering problem with text2base64 function and in turn I'm encountering authorization error.
Would you mind sharing your text2base64 function since you have successfully done it.
Thanks.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide