Click here to Skip to main content
15,879,348 members
Please Sign up or sign in to vote.
2.83/5 (4 votes)
See more:
Hi,
I want to create chat application like facebook,Gtalk etc.
I am also ready to purchase tool for it.
Please help me for finding chat tool.
Please suggest link for paid tool for chat application with source code.
Posted
Updated 27-Jan-13 19:48pm
v2

 
Share this answer
 
Comments
Manas Bhardwaj 11-Jul-12 16:57pm    
5+
Joezer BH 28-Jan-13 1:50am    
5+Literally on the spot ;)
Atinder Pal Singh 20-Jan-16 5:09am    
it is in php; we need asp.net
 
Share this answer
 
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;

namespace AJAXORama
{
  public class Global : System.Web.HttpApplication
{
  protected void Application_Start(object sender, EventArgs e)
  {
    // Code that runs on application startup
    List<string> messages = new List<string>();
    HttpContext.Current.Cache["Messages"] = messages;
  }
  // other generated code is here...
}


}
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
 
 
public partial class GroupChat : System.Web.UI.Page 
{ 
    protected void Page_Load(object sender, EventArgs e) 
    { 
    } 
 
    protected string GetUserID() 
    { 
        string strUserID =  
          (string) Session["UserID"]; 
        return strUserID; 
    } 
}


and disable the user identifcation UI elements:
C#
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
 
 
public partial class GroupChat : System.Web.UI.Page 
{ 
    protected void Page_Load(object sender, EventArgs e) 
    { 
    } 
    // other code goes here... 
    void ManageUI() 
    { 
        if (GetUserID() == null) 
 
        { 
            // if this is the first request, then get the user’s ID 
            TextBoxMessage.Enabled = false; 
            TextBoxConversation.Enabled = false; 
            ButtonAddYourMessage.Enabled = false; 
 
            ButtonSubmitID.Enabled = true; 
            TextBoxUserID.Enabled = true; 
        } 
        else 
        { 
            // if this is the first request, then get the user’s ID 
            TextBoxMessage.Enabled = true; 
            TextBoxConversation.Enabled = true; 
            ButtonAddYourMessage.Enabled = true; 
 
            ButtonSubmitID.Enabled = false; 
            TextBoxUserID.Enabled = false; 
        } 
    } 
}
  
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 494  Part V  Dynamic Data, XBAP, MVC, AJAX, and Silverlight
using System.Web.UI; 
using System.Web.UI.WebControls; 
 
public partial class GroupChat : System.Web.UI.Page 
{ 
    protected void Page_Load(object sender, EventArgs e) 
    { 
    } 
   // other page code goes here... 
    protected void ButtonSubmitID_Click(object sender, EventArgs e) 
    { 
        Session["UserID"] = TextBoxUserID.Text; 
        ManageUI(); 
    } 
}
  
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
 
public partial class GroupChat : System.Web.UI.Page 
{ 
   // other page code goes here... 
    void RefreshConversation() 
    { 
        List<string> messages = (List<string>)Cache["Messages"]; 
        if (messages != null) 
        { 
            string strConversation = ""; 
 
            int nMessages = messages.Count; 
 
            for(int i = nMessages-1; i >=0; i--) 
            { 
                string s; 
 
                s = messages[i]; 
                strConversation += s; 
                strConversation += "\r\n"; 
            } 
 
            TextBoxConversation.Text =  
                strConversation; 
        } 
    } 
} 
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
 
public partial class GroupChat : System.Web.UI.Page 
{ 
    // Other code goes here... 
    protected void ButtonAddYourMessage_Click(object sender,  
                                               EventArgs e) 
    { 
        // Add the message to the conversation... 
        if (this.TextBoxMessage.Text.Length > 0) 
        { 
            List<string> messages = (List<string>)Cache["Messages"]; 
            if (messages != null) 
            { 
                TextBoxConversation.Text = ""; 
 
                string strUserID = GetUserID(); 
 
                if (strUserID != null) 
                { 
                    messages.Add(strUserID +  
                        ": " +  
                        TextBoxMessage.Text); 
                    RefreshConversation(); 
                    TextBoxMessage.Text = ""; 
                } 
            } 
        } 
    } 
}
  
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
 
using System.Xml.Linq; 
using System.Collections.Generic; 
 
public partial class GroupChat : System.Web.UI.Page 
{ 
    // Other code goes here... 
    protected void Page_Load(object sender, EventArgs e) 
    { 
        ManageUI(); 
        RefreshConversation(); 
    } 
}</string></string></string></string>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900