Subject: Excepcion of tyoe 'agsxmpp.xml.xpnet.invalidtokenExcepcion' was thrown
Not yet profit to connect with correctly, at some time consegui and until I could send and receive mensages, but now it is impossible to me and when sending msg gives the following error me in the onerror event
Excepcion of tyoe 'agsxmpp.xml.xpnet.invalidtokenExcepcion' was thrown
please if somebody has an example in ASPx in visual BASIC .net or that can orient to me for knowledge which I am making bad.
shipment all the code of my page
Default.aspx
Imports System
Partial Class _Default
Inherits System.Web.UI.Page
Dim Jid As agsXMPP.Jid
Dim cb As agsXMPP.MessageCB
Dim cb1 As agsXMPP.PresenceCB
Dim sUsuario_Conversa As String = "alejandro.ceballos.g@gmail.com"
Dim oConn_XMPP As New agsXMPP.XmppClientConnection
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
oConn_XMPP = Session.Item("Conn")
With oConn_XMPP
.Open()
Session.Remove("Conn")
Session.Add("Conn", oConn_XMPP)
End With
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim oMsg_XMPP As New agsXMPP.protocol.client.Message(sUsuario_Conversa, txt_msg.Text)
oConn_XMPP = Session.Item("Conn")
With oConn_XMPP
If .XmppConnectionState = agsXMPP.XmppConnectionState.Connected Then
.Send(oMsg_XMPP)
txt_Chat.Text += UCase(txt_Usuario.Text) & " : " & txt_msg.Text & Chr(13) & Chr(10)
End If
End With
Session.Remove("Conn")
Session.Add("Conn", oConn_XMPP)
End Sub
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
oConn_XMPP = Session.Item("Conn")
With oConn_XMPP
.Close()
Button3.Enabled = False
Button1.Enabled = True
End With
Session.Remove("Conn")
Session.Add("Conn", oConn_XMPP)
End Sub
Protected Sub btn_Refresca_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_Refresca.Click
Dim oConn_XMPP As New agsXMPP.XmppClientConnection
oConn_XMPP = Session.Item("Conn")
With oConn_XMPP
End With
Session.Remove("Conn")
Session.Add("Conn", oConn_XMPP)
End Sub
Private Sub MessageCallback(ByVal sender As Object, ByVal msg As agsXMPP.protocol.client.Message, ByVal data As Object)
txt_Chat.Text += msg.From.User & " said: " & msg.Body & Chr(13) & Chr(10)
End Sub
Private Sub FUNC_OnLogin(ByVal sender As Object)
Button1.Enabled = False
Button3.Enabled = True
MsgBox("test")
End Sub
Private Sub FUNC_OnError(ByVal sender As Object, ByVal ex As System.Exception)
MsgBox(ex.Message)
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
With oConn_XMPP
'Usuario con el que se conecta
Jid = New agsXMPP.Jid(txt_Usuario.Text)
cb = New agsXMPP.MessageCB(AddressOf MessageCallback)
.MesagageGrabber.Add(Jid, cb, Nothing)
AddHandler .OnLogin, AddressOf FUNC_OnLogin
AddHandler .OnError, AddressOf FUNC_OnError
AddHandler .OnReadXml, AddressOf FUNC_OnReadXml
AddHandler .OnWriteXml, AddressOf FUNC_OnWriteXml
.SocketConnectionType = agsXMPP.net.SocketConnectionType.Direct
.Server = "gmail.com"
.ConnectServer = "talk.google.com"
.Username = txt_Usuario.Text
.Password = txt_Clave.Text
.Port = "5222"
.UseSSL = False
.UseStartTLS = True
.Status = "Online"
.Priority = 5
.AutoResolveConnectServer = True
.RegisterAccount = False
.Show = agsXMPP.protocol.client.ShowType.chat
.Open()
Session.Remove("Conn")
Session.Add("Conn", oConn_XMPP)
End With
End Sub
Private Sub FUNC_OnReadXml(ByVal sender As Object, ByVal xml As String)
rtfDebug.Text = "Read : " & xml
End Sub
Private Sub FUNC_OnWriteXml(ByVal sender As Object, ByVal xml As String)
rtfDebug.Text = "Write : " & xml
End Sub
End Class
global.asax
Dim oConn As New agsXMPP.XmppClientConnection
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application startup
End Sub
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application shutdown
End Sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when an unhandled error occurs
End Sub
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when a new session is started
Session.Add("Conn", oConn)
End Sub
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when a session ends.
' Note: The Session_End event is raised only when the sessionstate mode
' is set to InProc in the Web.config file. If session mode is set to StateServer
' or SQLServer, the event is not raised.
End Sub
Excepcion of tyoe 'agsxmpp.xml.xpnet.invalidtokenExcepcion' was thrown
please if somebody has an example in ASPx in visual BASIC .net or that can orient to me for knowledge which I am making bad.
shipment all the code of my page
Default.aspx
Imports System
Partial Class _Default
Inherits System.Web.UI.Page
Dim Jid As agsXMPP.Jid
Dim cb As agsXMPP.MessageCB
Dim cb1 As agsXMPP.PresenceCB
Dim sUsuario_Conversa As String = "alejandro.ceballos.g@gmail.com"
Dim oConn_XMPP As New agsXMPP.XmppClientConnection
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
oConn_XMPP = Session.Item("Conn")
With oConn_XMPP
.Open()
Session.Remove("Conn")
Session.Add("Conn", oConn_XMPP)
End With
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim oMsg_XMPP As New agsXMPP.protocol.client.Message(sUsuario_Conversa, txt_msg.Text)
oConn_XMPP = Session.Item("Conn")
With oConn_XMPP
If .XmppConnectionState = agsXMPP.XmppConnectionState.Connected Then
.Send(oMsg_XMPP)
txt_Chat.Text += UCase(txt_Usuario.Text) & " : " & txt_msg.Text & Chr(13) & Chr(10)
End If
End With
Session.Remove("Conn")
Session.Add("Conn", oConn_XMPP)
End Sub
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
oConn_XMPP = Session.Item("Conn")
With oConn_XMPP
.Close()
Button3.Enabled = False
Button1.Enabled = True
End With
Session.Remove("Conn")
Session.Add("Conn", oConn_XMPP)
End Sub
Protected Sub btn_Refresca_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_Refresca.Click
Dim oConn_XMPP As New agsXMPP.XmppClientConnection
oConn_XMPP = Session.Item("Conn")
With oConn_XMPP
End With
Session.Remove("Conn")
Session.Add("Conn", oConn_XMPP)
End Sub
Private Sub MessageCallback(ByVal sender As Object, ByVal msg As agsXMPP.protocol.client.Message, ByVal data As Object)
txt_Chat.Text += msg.From.User & " said: " & msg.Body & Chr(13) & Chr(10)
End Sub
Private Sub FUNC_OnLogin(ByVal sender As Object)
Button1.Enabled = False
Button3.Enabled = True
MsgBox("test")
End Sub
Private Sub FUNC_OnError(ByVal sender As Object, ByVal ex As System.Exception)
MsgBox(ex.Message)
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
With oConn_XMPP
'Usuario con el que se conecta
Jid = New agsXMPP.Jid(txt_Usuario.Text)
cb = New agsXMPP.MessageCB(AddressOf MessageCallback)
.MesagageGrabber.Add(Jid, cb, Nothing)
AddHandler .OnLogin, AddressOf FUNC_OnLogin
AddHandler .OnError, AddressOf FUNC_OnError
AddHandler .OnReadXml, AddressOf FUNC_OnReadXml
AddHandler .OnWriteXml, AddressOf FUNC_OnWriteXml
.SocketConnectionType = agsXMPP.net.SocketConnectionType.Direct
.Server = "gmail.com"
.ConnectServer = "talk.google.com"
.Username = txt_Usuario.Text
.Password = txt_Clave.Text
.Port = "5222"
.UseSSL = False
.UseStartTLS = True
.Status = "Online"
.Priority = 5
.AutoResolveConnectServer = True
.RegisterAccount = False
.Show = agsXMPP.protocol.client.ShowType.chat
.Open()
Session.Remove("Conn")
Session.Add("Conn", oConn_XMPP)
End With
End Sub
Private Sub FUNC_OnReadXml(ByVal sender As Object, ByVal xml As String)
rtfDebug.Text = "Read : " & xml
End Sub
Private Sub FUNC_OnWriteXml(ByVal sender As Object, ByVal xml As String)
rtfDebug.Text = "Write : " & xml
End Sub
End Class
global.asax
Dim oConn As New agsXMPP.XmppClientConnection
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application startup
End Sub
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application shutdown
End Sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when an unhandled error occurs
End Sub
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when a new session is started
Session.Add("Conn", oConn)
End Sub
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when a session ends.
' Note: The Session_End event is raised only when the sessionstate mode
' is set to InProc in the Web.config file. If session mode is set to StateServer
' or SQLServer, the event is not raised.
End Sub