I'm testing Cute Chat to see if I want to buy it for my websites. I've incorporated Cute Chat into an asp.net membership website. However, I NEVER want the users to see the Username since this is used for login to the website. Is there a way to always prompt for a Display Name when entering a chat room and ALWAYS use THAT in the chat rooms - NEVER the username? It's OK to use the username in the database.
Here is the global.asax code I'm currently using.
- <%@ Application Language="C#" %>
- <%@ Import Namespace="CuteChat" %>
-
- <script runat="server">
-
- void Application_Start(object sender, EventArgs e) {
- if (!Roles.RoleExists("Administrator")) Roles.CreateRole("Administrator");
-
- ChatProvider.Instance = new AspNetChatProvider();
- ChatSystem.Start(new AppSystem());
-
- }
-
- static private string CuteChatConnectionStringConfigName = "SQL2008_355184_poetrysoupConnectionString";
-
- public string GetConnectionString(string reserved)
- {
- return System.Configuration.ConfigurationManager.ConnectionStrings[CuteChatConnectionStringConfigName].ConnectionString;
- }
-
-
- public class AspNetChatProvider : ChatProvider
- {
- public override string GetConnectionString()
- {
- return System.Configuration.ConfigurationManager.ConnectionStrings[CuteChatConnectionStringConfigName].ConnectionString;
- }
-
- public override AppChatIdentity GetLogonIdentity()
- {
- System.Web.Security.MembershipUser user = System.Web.Security.Membership.GetUser();
-
- if (user != null && user.IsApproved)
- {
- return new AppChatIdentity(user.UserName, false, ToUserId(user.UserName), HttpContext.Current.Request.UserHostAddress);
- }
-
- return null;
- }
-
- public override string FindUserLoginName(string nickName)
- {
- System.Web.Security.MembershipUser user = System.Web.Security.Membership.GetUser(nickName,false);
- if (user != null && user.IsApproved)
- return user.UserName;
- return null;
- }
- public override bool GetUserInfo(string loginName, ref string nickName, ref bool isAdmin)
- {
- System.Web.Security.MembershipUser user = System.Web.Security.Membership.GetUser(loginName, false);
- if (user != null && user.IsApproved)
- {
- nickName=user.UserName;
- isAdmin=Roles.IsUserInRole(user.UserName,"Administrator");
- return true;
- }
- return false;
- }
-
- public override bool ValidateUser(string username, string password)
- {
- if (!System.Web.Security.Membership.ValidateUser(username, password))
- {
- return false;
- }
-
- System.Web.Security.FormsAuthentication.SetAuthCookie(username, false, HttpRuntime.AppDomainAppVirtualPath);
-
- return true;
- }
- }
-
-
- </script>