Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
SamBrands #1
Member since Apr 2012 · 2 posts
Group memberships: Members
Show profile · Link to this post
Subject: My xmpp object doesn't get authenticated in my ASP.Net chat application
Hello,

I need to create a chat application with ASP.Net where users can login with their google talk account and can chat with their friends.
For some reason when i try to connect with the xmpp, the xmpp doesn't get authenticated.

Here is the code:
  1. /// <summary>
  2. /// Creates a xmpp object and connects it to google talk with as username the text in the username textbox and as password the text in the password textbox
  3. /// </summary>
  4. private void login()
  5. {
  6.     xmpp = (XmppClientConnection)Session["xmpp"];
  7.     if (xmpp == null)
  8.     {
  9.         xmpp = new XmppClientConnection();
  10.         Session["xmpp"] = xmpp;
  11.     }
  12.     string user = tbxUsername.Text;
  13.     string password = tbxPassword.Text;
  14.  
  15.     xmpp.AutoPresence = true;
  16.     xmpp.AutoResolveConnectServer = true;
  17.     xmpp.Port = 5222;
  18.     xmpp.Server = "gmail.com";
  19.     xmpp.ConnectServer = "talk.google.com";
  20.     xmpp.Username = tbxUsername.Text;
  21.     xmpp.Password = tbxPassword.Text;
  22.     xmpp.Open();
  23.     xmpp.SendMyPresence();
  24.  
  25.     while (xmpp.Authenticated == false)
  26.     {
  27.         System.Threading.Thread.Sleep(10);
  28.     }
  29.    
  30.  
  31.     linkEvents();
  32.     client = new User(new Jid(tbxUsername.Text + "@gmail.com"), ShowType.chat, tbxStatus.Text);
  33.     Session["client"] = client;
  34.  
  35.     //xmpp.Open();
  36.  
  37.     #region Enable and disable buttons
  38.     btnLogin.Enabled = false;
  39.     btnLogout.Enabled = true;
  40.     btnSend.Enabled = true;
  41.     btnChatUser.Enabled = true;
  42.     #endregion
  43.  
  44.     UpdatePanelMessageBox.Update();
  45.     UpdatePannelChatBox.Update();
  46. }
Note: the username is only the username without @gmail.com
This post was edited 2 times, last on 2012-04-17, 18:01 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Please post yor complete Xml log.

You should remove
  1. xmpp.SendMyPresence();
after
  1. Xmpp.Open();
because you cannot send any packets before you are logged in.

Alex
Avatar
SamBrands #3
Member since Apr 2012 · 2 posts
Group memberships: Members
Show profile · Link to this post
Hmmm.... this might be a stupid question but i'm just gonna ask it.. :)
What are Xml logs, could you maby send me a website how to get the xml logs?

Thank you verry much for helping.
Avatar
Alex #4
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Look at the sticky thread in this forum above your thread.
This post was edited on 2012-04-19, 14:55 by 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