Click here to Skip to main content
15,867,686 members
Articles / Web Development / ASP.NET

A. R. Live Support: XML Based Customer Support Chat Solution

Rate me:
Please Sign up or sign in to vote.
4.58/5 (22 votes)
16 Dec 2008CPOL2 min read 141.8K   5.4K   81   84
Customer Support chat solution build using ASP.NET(2.0) with C# and XML as a database.
ChooseChannel.jpg

UserWindow.jpg

AgentResponse.jpg

Introduction

I have checked out a lot of chat solutions and all of then were database driven. These applications fail as soon as the database is down and in live systems, this scenario is not unknown. So, I decided to build a Chat Solution that should be database independent. So, XML is the best replacement.

This is my first article and A. R. Live Support is the first solution I have developed using XML.

Background

A. R. Live Support is an online chat software, developed in ASP.NET(2.0) and XML. It is easy to use and facilitates 1-o-1 live communication between customers and executives. It is a flexible live chat software that provides the customer support with a click.

The main features are:

  1. Built with HTML, JavaScript, XML, C#, using Ajax techniques
  2. NO DATABASE: No need for a database (since it is XML based)
  3. No Flashing: Based on advanced Ajax techniques, the chat screen refreshes every second(this can be customized), and changes on the screen do not require a screen refresh
  4. NO ACTIVEX or PLUGINS, etc. - because it is not Java based, the user does not need to install plugins, or have Java components on the machine. A combination of JavaScript, XML and C# ASP.NET makes this possible.
  5. NO MEMORY STORAGE for messages, users; everything gets stored in XML files. This feature allows several chat rooms and even chat applications to run on the same server.
  6. EASY TO INSTALL - Just unzip a *.zip file on the server, create a virtual directory, and the chat is ready.
  7. ANY MAJOR BROWSER OK - Internet Explorer, Netscape, Mozilla Firefox, Opera

Code Walkthrough

  1. I will start from a code that will be used to call the Server repeatedly for fetching the most recent information:

    C#
    function InitializeTimer()
    {
        // Set the length of the timer,
        // in seconds. Your choice
        secs = 2;
        StopTheClock();
        StartTheTimer();
    }
    function StopTheClock()
    {
        if(timerRunning)
            clearTimeout(timerID);
        timerRunning = false
    }
    function StartTheTimer()
    {
        if (secs==0)
        {
            StopTheClock();
    	ajax_MakeAnAJAXGetCall();
            //Generate a Postback to the server
            InitializeTimer();
            // Start the timer again
        }
        else
        {
            secs = secs - 1;
            timerRunning = true;
            timerID = self.setTimeout("StartTheTimer()", delay);
        }
    }
    
    //AJAX Function
    function makeRequest()
    {
    	var xmlHttpRequest = null;
    	/*
    	* For Firefox, Mozilla, Safari
    	*/	
    	if (window.XMLHttpRequest)
    	{
    		xmlHttpRequest = new XMLHttpRequest();
    	}
    	/*
    	* For Microsoft Internet Explorer
    	*/
    	else if (typeof ActiveXObject != "undefined")
    	{
    		xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
    	}
    	return xmlHttpRequest;
    }//END of Function makeRequest
    
    function ajax_MakeAnAJAXGetCall()
    {
    	ajaxObj = makeRequest();
    	//alert('HELLO');
    	if (ajaxObj != null)
    	{
    		var dt = new Date();		
    		var URL = serverURL;
    		URL += '?id=' + document.getElementById('lblID').innerHTML + 
    			'&dt1=' + dt.getHours()+ '&dt2=' + dt.getMinutes();
    		//alert(URL);
    		StopTheClock();
    		ajaxObj.open("GET", URL, true);
    		ajaxObj.onreadystatechange = ajax_CallBack;
    		ajaxObj.send(null);
    	}
    	else
    	{
    		
    	}	
    	return false;
    }
    
    function OpenPop(strId)
    {
        window.open('execChatWindow.aspx?id=' + strId,'','width=520,height=490');
    }
    
    function ContactServer()
    {
    	ajax_MakeAnAJAXGetCall(); //THis makes Ajax call to run 
    }
  2. Server side code to fetch the messages for User/Executive:

    C#
    string strResult = string.Empty;
    try
    {
      string chatId = Request.QueryString["cid"].ToString();
      string strXML = chatId + ".XML";  
      strResult = clsChatMessages.getUnReadMessages(Request.PhysicalApplicationPath, 
    		strXML,Request.QueryString["id"].ToString(), true);
    }
    finally
    {
    
    }

Points of Interest

  1. Chat is fully customizable, i.e. there are a lot of interesting settings in web.config.
  2. Initially it does not provide any reporting, but that can be generated using XML files.

History

  • 09-Nov-2008
    • Initial post of article
  • 18-Nov-2008
    • Selection of Departments for the Chat
    • [Bug Fix] in chat allocation
  • 16-Dec-2008
    • Chat Transfer between Executives
    • Password Encryption [RSA]

License

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


Written By
Team Leader
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralRe: Message is showing arlivesupport Pin
Aman Bhullar29-Jun-09 5:54
Aman Bhullar29-Jun-09 5:54 
GeneralRe: Message is showing arlivesupport Pin
platso_5887-Aug-09 3:57
platso_5887-Aug-09 3:57 
GeneralRe: Message is showing arlivesupport Pin
Aman Bhullar7-Aug-09 5:52
Aman Bhullar7-Aug-09 5:52 
GeneralHi help me out Pin
Welcome Dhinesh12-Jun-09 1:17
Welcome Dhinesh12-Jun-09 1:17 
GeneralRe: Hi help me out Pin
Aman Bhullar12-Jun-09 6:28
Aman Bhullar12-Jun-09 6:28 
GeneralRe: Hi help me out Pin
Rohit_kakria29-Jun-09 1:31
Rohit_kakria29-Jun-09 1:31 
GeneralRe: Hi help me out Pin
Aman Bhullar29-Jun-09 5:49
Aman Bhullar29-Jun-09 5:49 
QuestionIntegrating with my application Pin
riya319-Apr-09 1:53
riya319-Apr-09 1:53 
AnswerRe: Integrating with my application Pin
Aman Bhullar9-Apr-09 5:53
Aman Bhullar9-Apr-09 5:53 
GeneralRe: Integrating with my application Pin
riya319-Apr-09 20:08
riya319-Apr-09 20:08 
Generali have problem Pin
cangokdemir26-Mar-09 12:18
cangokdemir26-Mar-09 12:18 
GeneralRe: i have problem Pin
cangokdemir27-Mar-09 1:03
cangokdemir27-Mar-09 1:03 
GeneralRe: i have problem Pin
Aman Bhullar27-Mar-09 7:38
Aman Bhullar27-Mar-09 7:38 
GeneralChat styling Pin
karen longstaff22-Mar-09 13:53
karen longstaff22-Mar-09 13:53 
GeneralRe: Chat styling Pin
Aman Bhullar25-Mar-09 5:26
Aman Bhullar25-Mar-09 5:26 
Questionis only work after hosting ? Pin
Masood Kochi,SSF19-Mar-09 1:39
Masood Kochi,SSF19-Mar-09 1:39 
AnswerRe: is only work after hosting ? Pin
Aman Bhullar19-Mar-09 7:39
Aman Bhullar19-Mar-09 7:39 
GeneralNeed Code Pin
Member 28127049-Feb-09 19:55
professionalMember 28127049-Feb-09 19:55 
GeneralRe: Need Code Pin
Aman Bhullar10-Feb-09 6:45
Aman Bhullar10-Feb-09 6:45 
GeneralRe: Need Code Pin
Member 281270410-Feb-09 17:30
professionalMember 281270410-Feb-09 17:30 
GeneralRe: Need Code Pin
Aman Bhullar10-Feb-09 17:54
Aman Bhullar10-Feb-09 17:54 
GeneralRe: Need Code Pin
Member 281270410-Feb-09 21:06
professionalMember 281270410-Feb-09 21:06 
GeneralRe: Need Code Pin
platso_5887-Aug-09 4:16
platso_5887-Aug-09 4:16 
GeneralRe: Need Code Pin
Aman Bhullar7-Aug-09 5:55
Aman Bhullar7-Aug-09 5:55 
GeneralRe: Need Code Pin
deepak4dotnet24-Jun-09 21:26
deepak4dotnet24-Jun-09 21:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.