Loading ...

How to integrate Cute Chat Web Messenger in ASP.Net Application.

Who is online?  0 guests and 0 members
home  »  articles  »  How to integrate Cute Chat Web Messenger in ASP.Net Application.

How to integrate Cute Chat Web Messenger in ASP.Net Application.

(4138)
0
/5
Avg: 0/5: (0 votes)
Published: 6/4/2010 by  Sumit Arora

Cute Chat Web Messenger

 

In this article I’ll explain you how to integrate Cute Chat Web Messenger standalone version in ASP.Net.

 Cute Chat is a full-featured ASP.NET chat program. It comes with many inbuilt features such as private messaging, private chat room, ignoring users, file transfer, high load support, emoticons, customization of fonts/pics and many more. It is AJAX enabled chat system. It is very easy to integrate it with the web applications. It supports cross browser compatibility. Compatible with almost all the browsers. 

To know more about the features of Cute Chat Web Messenger.

http://cutesoft.net/ASP.NET+Chat/Developer-Guide/features-of-web-messenger.htm

Download Cute Chat Web Messenger

http://cutesoft.net/downloads/folders/chat_current_releases/entry21915.aspx


After downloading the Cute Chat Web Messenger from the above link.

Follow the below steps.

The steps which we need to follow in order to integrate Cute Chat Web Messenger.

Step 1: Install the Cute Chat database 

First of all we need to execute the script in the database. This can be done from the SQL Server Query Analyzer.

SQLScripts\cutechat3.sql

 

Step 2: Deploy the Cute Chat assembly and license file 

We need to copy the following files to the project \bin directory.

1.CuteSoft.Chat.dll

2. CuteChat.lic

3. CuteMessenger.lic

4. CuteLiveSupport.lic

 

Step 3: Deploy the Cute Chat client files 

Copy the CuteSoft_Client folder and the file it contains to the root level folder of the project
for example.  Project_FOLDER\ CuteSoft_Client .

Global.asax file should also be added to Project_FOLDER\ as well.

 

Step 4: Add the messenger button in your web pages

    <%="<"%><%="script"%><%=" src='"%><%=resolveurl("~/CuteSoft_Client/CuteChat/IntegrationUtility.js.aspx")%><%="'"%><%=">"%><%="<"%><%="/script"%><%=">"%>
   <img src="<%=resolveurl("~/CuteSoft_Client/CuteChat/images/icon_invite.gif")%>" align=absmiddle><a href="###" onclick="JavaScript:Chat_OpenMessenger()" >Messenger</a>
   
as high load support, font/color customization, emoticons, 

 

 

After deploying the files in the project root directory. We need to write the below code in the Global.asax. I’m identifying the unique identity of a user based on the email address. It can also be done based on the userID.

I’ve created MyChatProvider class which Inherits from the ChatProvider. In this class we have overridden the methods in order to validate the user.

//CUTE CHAT RELATED

public override void Init()

{

  base.Init();

  lock (typeof(CuteChat.ChatSystem))

  {

     if (!CuteChat.ChatSystem.HasStarted)

     {

       CuteChat.ChatProvider.Instance = new        MyChatProvider();

       CuteChat.ChatSystem.Start(new  CuteChat.AppSystem());

                 

     }

   }

 }

 

//CLASS THAT INHERITS FROM CUTE CHAT PROVIDER

 public class MyChatProvider: CuteChat.ChatProvider

 {

 

    /// <summary>

/// Get connection string for Cute Chat

/// </summary>

/// <returns></returns>

public override string GetConnectionString()

{

      return ConfigurationManager.ConnectionStrings

       ["MyCuteConnectionString"].ConnectionString;

}

 

 

          

/// <summary> 

/// Find a user and return its login name

/// else return null if the user is not found

/// </summary>

/// <param name="nickName"></param>

/// <returns></returns>

public override string FindUserLoginName(string  nickName)

{

 

// User Info class contains the properties and methods related to user such as getting   username,checking user authentication, user email etc.

 

UserInfo user = user.FindUser(nickName);

//nickName in this case is user email address

 

if (user.UserID <= 0)

   return null;

else

   return user.Email;

   //returns the email address of user

}

 

       

/// <summary>

/// Get the LogonIdentity for the current user

/// to be used in Cute Chat

/// </summary>

/// <returns></returns>

public override AppChatIdentity GetLogonIdentity()

{

 

 //need to find the information of current user.    // return null if user is anonymous.

UserContext userContext =  UserContext.Get(HttpContext.Current.Session);

               

if (userContext.UserID <= 0)

  return null;

 

 

// pass email address of a user in ToUserId() method. 

 

 

return new AppChatIdentity(userContext.UserName, false,ToUserId(EmailAddressOfAUser), HttpContext.Current.Request.UserHostAddress);

}

 

 

/// <summary>

/// returns false if the loginName is invalid

/// else set the nickName and isAdmin, and return true

/// </summary>

/// <param name="loginName"></param>

/// <param name="nickName"></param>

/// <param name="isAdmin"></param>

/// <returns></returns>

public override bool GetUserInfo(string loginName, ref string nickName, ref bool isAdmin)

{

  UserInfo user = Utilities.FindUser(loginName);

  //loginName in this case is email address of a user.

   if (user.UserID <= 0)

     return false;

   nickName = user.UserName;

   isAdmin = false;

     return true;

}

 

/// <summary>

/// Validate a chat user

/// </summary>

/// <param name="loginName"></param>

/// <param name="password"></param>

/// <returns></returns>

public override bool ValidateUser(string loginName, string password)

{

  

   bool isLogin = false;

   UserInfo user = new UserInfo();

   //loginName is the email address of a user

   user.Email = loginName;

   //password of a user

   user.Password = password;

   isLogin = user.Login();//returns true if login credential is correct.

 

   return isLogin;

 }

}

 

 

Once you validate the user you can start using the Cute Chat Web messenger.

 

There you are done with the integration of Cute Chat web Messenger with your Asp.net project.

 

Do let me know your valuable comments and inputs.

 

 

 

 

Comments (no comments yet)

Confirm

Product Spotlight

ASP.NET Hosting Spotlight

Most Recent Articles

 

Product Spotlight

ASP.NET Hosting Spotlight

Quick Vote

What kind of email newsletter would you prefer to receive from CodeAsp.Net?