cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
404
Views
0
Helpful
2
Replies

IP Phone reset when run /CG/Execute with VB in ASP.NET

lyf20040507
Level 1
Level 1

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

=====================================================

2 Replies 2

lyf20040507
Level 1
Level 1

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

=====================================================

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.