Problems with embed-Chat

Last post 12-14-2007, 10:04 AM by Adam. 1 replies.
Sort Posts: Previous Next
  •  12-14-2007, 6:06 AM 35806

    Problems with embed-Chat

    Hello,

     

    We plan to use CuteChat4 in a CMS-Environment, embedded in a UserControl, using the login-information of the CMS.

    The Chat is working, offline on my own PC as well as online, but as soon as I log on to the Chat, the chat thinks, I am the first user logged on, after the chat was started (CuteChat.ChatSystem.Start). Also I cannot log on with another user, becouse the chat thinks I am the same user.

    Offline on my PC I checkt the programm in debug-modus and found out, that the function “GetUserInfo” (and other such functions) are never called after the first start.

    So I have 2 questions.

    First, how do I make the chatsystem notice, that there is a new user logging in and

    Second, which Developer’s Guide is the actuell one? There is one in the downloadsection (http://cutesoft.net/downloads/folders/chat_documentation/default.aspx) and another one is in the Cute Chat and Web Messenger integration package. The Integration-Part of the Guid’s is quite different.

     

    Thanks for any help.

    Regards, Jan.

     

    Code:

     

    ChatControl is being loaded in the CMS.

     

    public partial class ChatControl : PortalModuleControl

    {

        protected void Page_Load(object sender, EventArgs e)

          {

            sUserID="xxx";

            CuteChat.ChatProvider.Instance = new MyChat(sCompanyID, sUserID);

            if(!CuteChat.ChatSystem.HasStarted)

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

          }

    }

    public class MyChat : CuteChat.ChatProvider

    {

        String gsUid;

        public MyChat(String uid)

        {

            gsUid = uid;

        }

        public override string GetConnectionString()

        {

            String s = System.Configuration.ConfigurationSettings.AppSettings["Chat_ConnectionString"];

            return s;

        }

     

        public override string FindUserLoginName(string nickName)

        {

            return gsUid;

        }

        public override AppChatIdentity GetLogonIdentity()

        {

            string loginname = gsUid;

            string nickname = xxx_lib.GetNickName(loginname);

            return new AppChatIdentity(nickname, false, ToUserId(loginname), HttpContext.Current.Request.UserHostAddress);

        }

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

        {

               nickName = xxx_lib.GetNickName(loginName);

               isAdmin = false;

               return true;

        }

        public override bool ValidateUser(string loginName, string password)

        {

                // User-Validation is done by the CMS

                return true;

        }

    }

  •  12-14-2007, 10:04 AM 35814 in reply to 35806

    Re: Problems with embed-Chat

    There are some issues with your code :

    1. the ChatProvider should be a single instance .
    And will be initialized when application starts.
    So you should not create it in your control.
    And it should not be relatived to a user.

    2. FindUserLoginName
    please use the argument 'nickName'
    try to find it from database , and return the 'loginName'

    3. GetLogonIdentity
    please use HttpContext.Current to get the login info
    for example ,
    string loginname=HttpContext.User.Identity.Name;

    4. ValidateUser
    This function is for CuteLiveSupport only.


    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View as RSS news feed in XML