Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
eqi #1
Member since Feb 2008 · 1 post
Group memberships: Members
Show profile · Link to this post
Subject: Can not send to gtalk in asp.net page
I tested the send message from the SDK package and it did not working on both my home computer and office computer.
I created a simple asp.net page and added a button to invoke the event. It simply not working. Here is the c# code.

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using agsXMPP;
using agsXMPP.protocol.client;
using agsXMPP.Collections;
using agsXMPP.protocol.iq.roster;
using System.Threading;

public partial class Chat : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
      
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        XmppClientConnection xmpp = new XmppClientConnection();
        xmpp.Server = "gmail.com";
        xmpp.Username = "gmail account";
        xmpp.Password = "gamil password";
        xmpp.Open();
        xmpp.AutoResolveConnectServer = true;
        xmpp.SocketConnectionType = agsXMPP.net.SocketConnectionType.Direct;
        xmpp.UseStartTLS = true;
        agsXMPP.Jid JID = new Jid("receiver@gmail.com");
        agsXMPP.protocol.client.Message msg = new agsXMPP.protocol.client.Message();
        msg.Type = agsXMPP.protocol.client.MessageType.chat;
        msg.To = JID;
        msg.Body = "Hello " + DateTime.Now.ToString();
        xmpp.OnLogin += delegate(object o) { xmpp.Send(msg); };
        Thread.Sleep(5000);    

    }

}
This post was edited on 2008-02-26, 19:58 by eqi.
Avatar
Alex #2
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Can you subscribe to the events OnReadXml and OnWriteXml and post your debug XML?
Does this code work for you when you put it into a windows forms or console application?

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS