Chat Box in .NET

This article introduces Chat Box in .NET. Chat box can make websites and web applications more user interactive and provide a dynamic look too.

Chat box can make websites and web applications more user interactive and provide a dynamic look too. The functionality of chat box in a website is increasing day by day, because it provides some extra functionalities and looks.

Chat Box | Functionalities

There are many useful applications and functionalities that we get from chat box, the following are the most useful:

  • Provides dynamic look
  • Makes website more user interactive
  • Works as a web forum too
  • Requires less loading time
  • Makes websites more stylish
  • Can be created for any type of website

Chat Box | Approaches

There are a number of approaches or methodologies available for developing chat box for your website or web applications. But most suitable and easy approaches are few (some of these I mentioned below in a chart).

For developing chat box for your website or web application you can follow these 3 approaches.

developing chat box

Chat Box | Procedure

No extra effort is required for developing this functionality for your website. Simply what you need to do is:

  • Open Visual Studio
  • Create a new page (class file)

    Add class file

     
  • Design your chat box (through HTML and CSS).

     
  • Coding (as shown below):

    Coding
     

Chat Box | Development

The chat box code that I am describng here is a combination of GAIA Toolkit and Coding. I am doing this coding in C#.

Chat Box | Coding | C#.NET

  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Web;  
  5. using System.Web.UI;  
  6. using System.Web.UI.WebControls;  
  7. public partial class Default3 : System.Web.UI.Page  
  8. {  
  9.     protected void Page_Load(object sender, EventArgs e)  
  10.     {  
  11.     }  
  12.     protected void Button1_Click(object sender, EventArgs e)  
  13.     {  
  14.         Window1.Visible = true;  
  15.     }  
  16.     private string Chat  
  17.     {  
  18.         get  
  19.         {  
  20.             if (Application["a"] == null)  
  21.                 Application["a"] = "";  
  22.             return Application["a"].ToString();  
  23.         }  
  24.         set  
  25.         {  
  26.            Application["a"] = value;  
  27.         }  
  28.     }  
  29.     protected void Timer1_Tick(object sender, EventArgs e)  
  30.     {  
  31.         Label1.Text = Chat;  
  32.     }  
  33.     protected void Button2_Click(object sender, EventArgs e)  
  34.     {  
  35.         Chat = TextBox1.Text +"<br/>"+ Chat;  
  36.     }  
  37. }
Chat Box