Problem in integrating with a simple application of mine

Last post 01-28-2009, 1:58 PM by Qandil. 10 replies.
Sort Posts: Previous Next
  •  01-27-2009, 3:09 PM 48115

    Problem in integrating with a simple application of mine

    Hello,
     
    Am facing a couple of problems but finally i got this
     
     

     
    This is My code
     
     
     
     
     public class AspNetChatProvider : ChatProvider
        {
            public override string GetConnectionString()
            {
                return System.Configuration.ConfigurationManager.ConnectionStrings[CuteChatConnectionStringConfigName].ConnectionString;
            }

            public override AppChatIdentity GetLogonIdentity()
            {
                if (HttpContext.Current == null)
                    return null;
                if (HttpContext.Current.Session == null)
                    return null;
                if(HttpContext.Current.Session["User"] == null)
                    return null;
                string _user = HttpContext.Current.Session["User"].ToString();

                mySite.DAL.Member _mem = new mySite.DAL.Member(mySite.DAL.Member.Columns.MemberId, _user);
                //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);
                //}
                if (_mem != null)
                {
                    return new AppChatIdentity(_mem.Email, false, ToUserId( _mem.MemberId), HttpContext.Current.Request.UserHostAddress);
                }

                return null;
            }

            public override string FindUserLoginName(string nickName)
            {
                //if (nickName == "admin")
                //{
                //    return "Admin";
                //}

                mySite.DAL.Member _mem = new mySite.DAL.Member(mySite.DAL.Member.Columns.Email, nickName);
                if (_mem != null && !string.IsNullOrEmpty(_mem.MemberId))
                {
                    return _mem.FirstName + " " + _mem.FullName;
                }
                //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, "Administrators");
                //    return true;
                //}
                ////return false;

                //if (loginName == "admin")
                //{
                //    nickName = "Admin";
                //    isAdmin = true;
                //    return true;
                //}

                mySite.DAL.Member _mem = new mySite.DAL.Member(mySite.DAL.Member.Columns.Email, loginName);
                if (_mem != null && !string.IsNullOrEmpty(_mem.MemberId))
                {
                    nickName = _mem.Email;
                    isAdmin = _mem.Email == "myemail@mydomain.com" ? true : false;
                    return true;
                }
                return false;
            }

            public override bool ValidateUser(string username, string password)
            {
                //if (username == "admin" && password == "admin")
                //    return true;
                mySite.Business.Member _member = new mySite.Business.Member();
                if (_member.LoadMemberByEmail(username))
                {
                    if (_member.CheckPassword(password))
                    {

                        System.Web.Security.FormsAuthentication.SetAuthCookie(username, false, HttpRuntime.AppDomainAppVirtualPath);
                        //HttpContext.Current.Session["User"] = _member.ID;
                        return true;
                    }
                    else
                        return false;
                }
                else
                {
                    return false;
                }
            }
        }
     
     
    Thanks

  •  01-27-2009, 3:25 PM 48116 in reply to 48115

    Re: Problem in integrating with a simple application of mine

    Please change ValidateUser to:
     
     public override bool ValidateUser(string username, string password)
            {
                if (username == "admin" && password == "admin")
                 return true;
            }
    Then try again.

    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

  •  01-27-2009, 3:39 PM 48118 in reply to 48116

    Re: Problem in integrating with a simple application of mine

    This is what i get after using admin admin
     

     
  •  01-27-2009, 3:43 PM 48119 in reply to 48118

    Re: Problem in integrating with a simple application of mine

    BTW i used this to make it run
     
     public override bool ValidateUser(string username, string password)
            {
                if (username == "admin" && password == "admin")
                    return true;
                return false;
            }
  •  01-27-2009, 3:50 PM 48120 in reply to 48118

    Re: Problem in integrating with a simple application of mine

    Then please check this funtion:
     
    public override bool GetUserInfo(string loginName, ref string nickName, ref bool isAdmin)

    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

  •  01-27-2009, 3:58 PM 48121 in reply to 48120

    Re: Problem in integrating with a simple application of mine

    Am not sure what do you want me to do, mainly my member get Auth is the Session["User"] equals his Id
     
     
    What do u want me to edit it to ?
     
     
    Thanks
  •  01-27-2009, 4:02 PM 48122 in reply to 48121

    Re: Problem in integrating with a simple application of mine

    if i changed to this
     
    public override bool GetUserInfo(string loginName, ref string nickName, ref bool isAdmin)
            {
                if (loginName == "admin")
                {
                    nickName = "admin";
                    isAdmin = true;
                    return true;
                }
                return false;
            }
     
    but i get the same result as the first Screen shot i posted
     
     
    Thanks
  •  01-27-2009, 6:19 PM 48126 in reply to 48122

    Re: Problem in integrating with a simple application of mine

    i guess i figured out my problem
     
    Since am using the session to store the logged member information i need to find a way to access it throw the cute chat but it always gives me Object ref. not set to an Object
     
     
    I guess i need help to find a way out
     
    Thanks
  •  01-27-2009, 8:14 PM 48127 in reply to 48126

    Re: Problem in integrating with a simple application of mine

    maybe i found a solution with cookies but when i tried to start it it said that the ChatLiveSupport.lic is missing and when i downloaded it it said that it is expired then under that product ver. do not match
     
     
    Any Ideas ????
  •  01-28-2009, 10:08 AM 48151 in reply to 48127

    Re: Problem in integrating with a simple application of mine

    Which version of Cute Live Support are you using? The latest version is 5.0.
     
    Keep me posted

    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

  •  01-28-2009, 1:58 PM 48166 in reply to 48151

    Re: Problem in integrating with a simple application of mine

    Hello again,
     
    I fixed it by replacing the bin, and yep it is 5.0
     
    Thanks for our support,
     
    But i guess the integration help need to provide more details for system dont use Membership which focus on Session base applications 
     
     
    Regards,
View as RSS news feed in XML