Integration with an existing user membership database (C#)
Before you get started, you need to understand the 'UniqueName'
in CuteChat. In CuteChat, UniqueName means the unique data of your user.
Depending on how you implement the user system, in some systems, the best
unique data is the user ID; in some system, every user have a unique account
name; some systems like MSN, the unique data is the user email. It could be
string(username, email), integer(user ID) or GUID.
Unzip the integration package zip file and open cs/Global.asax file.
 |
Implement IHttpApplicationConnectionStringProvider interface and Let CuteChat
know the database connection string
In this step, you need to implement one simple method:
//Retrieves the Cute Chat database
connection string
public string GetConnectionString(CuteSoft.Chat.UserIdentity user)
Code Example
public string GetConnectionString(CuteSoft.Chat.UserIdentity user)
{
return
System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];
}
|
 |
Implement IHttpApplicationUserAdapter interface and Let CuteChat know who has
logged in the website
In this step, you need to implement one simple method:
//Retrieves the unique identity of the
current user
public CuteSoft.Chat.UserIdentity GetUserIdentity()
Code Example
public string GetUserUniqueName()
{
if
(Context.User.Identity.IsAuthenticated)
return
Context.User.Identity.Name;
return null;
}
public CuteSoft.Chat.UserIdentity GetUserIdentity()
{
string uniquename = GetUserUniqueName();
if (uniquename == null)
{
return
CuteSoft.Chat.UserIdentity.CreateNull();
}
CuteSoft.Chat.UserIdentity identity = new
CuteSoft.Chat.UserIdentity(uniquename, null, Request.UserHostAddress);
return identity;
}
|