Chat doesn't recognize logged in user

  •  12-31-2008, 11:14 AM

    Chat doesn't recognize logged in user

    I have integrated the Chat Release 5 into my site, but it keeps telling me that i need to be logged in.  i've integrated it using the chat provider, and can see that the code is called.  This same code worked in version 4.  Is there something i'm missing.
     
    I've implemented the ChatProvider for my site as seen below:

    ///

    <summary>

    ///

    CuteChat .NET Provider for site.com

    ///

    </summary>

    public class MyChatProvider : CuteChat.ChatProvider {

    private User _user;

    ///

    <summary>

    ///

    Gets the connection string.

    ///

    </summary>

    ///

    <returns></returns>

    public override string GetConnectionString() {

    return ConfigurationManager.ConnectionStrings[ "MainConnection" ].ConnectionString;

    }

    ///

    <summary>

    ///

    Finds the name of the user login.

    ///

    </summary>

    /// <param name="nickName">Name of the nick.

    </param>

    ///

    <returns></returns>

    public override string FindUserLoginName( string nickName ) {

    String screenname = Common.Screenname;

    if ( screenname == String.Empty ) {

    UserController controller = new UserController();

    _user = controller.GetUserByScreenName( nickName );

    if ( _user == null ) {

    return null;

    }

    else {

    return _user.Screenname;

    }

    }

    else {

    return screenname;

    }

    }

    ///

    <summary>

    ///

    Gets the logon identity.

    ///

    </summary>

    ///

    <returns></returns>

    public override CuteChat.AppChatIdentity GetLogonIdentity() {

    UserController controller = new UserController();

    _user = controller.GetUserByID( Common.UserId );

    if ( _user != null && _user.IsActive ) {

    return new CuteChat.AppChatIdentity( _user.Screenname, _user.isPublic, ToUserId( _user.Screenname ), HttpContext.Current.Request.UserHostAddress );

    }

    return null;

    }

    ///

    <summary>

    ///

    Gets the user info.

    ///

    </summary>

    /// <param name="loginName">Name of the login.

    </param>

    /// <param name="nickName">Name of the nick.

    </param>

    /// <param name="IsAdmin">if set to <c>true</c> [is admin].

    </param>

    ///

    <returns></returns>

    public override bool GetUserInfo( string loginName, ref string nickName, ref bool IsAdmin ) {

    UserController controller = new UserController();

    _user = controller.GetUserByID( Common.UserId );

    if ( _user != null && _user.IsActive ) {

    IsAdmin = _user.IsAdmin;

    loginName = _user.UserName;

    nickName = _user.Screenname;

    return true;

    }

    return false;

    }

    ///

    <summary>

    ///

    Validates the user.

    ///

    </summary>

    /// <param name="loginName">Name of the login.

    </param>

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

    </param>

    ///

    <returns></returns>

    public override bool ValidateUser( string loginName, string password ) {

    UserController controller = new UserController();

    _user = controller.GetUserByUserNameAndPassword( loginName, password );

    if ( _user != null ) { return true; }

    return false;

    }

    }

View Complete Thread