Re: Asp database site

  •  09-03-2004, 9:36 AM

    Re: Asp database site

     
    Yes , the CuteChat support any user-data-model .
    (SqlServer,Access..Databases.. Passport,SharePoint,ActiveDirectory...)
     
    Please open the :
    C:\Program Files\CuteSoft\CuteChat\Toolkit\Solution
     
    There is some sample about intergate the user-model for existing website .
     
    If you what to do that too , you must create a class that inherits CuteChat.SqlServer.SqlDataProvider
     
    for example :
     
    public class MyDataProvider : CuteChat.SqlServer.SqlDataProvider
    {
        //this connectionsting is for SqlServer2000/MSDE2000
        public YourDataProvider (string connectionstring):base(connectionstring)
        {
        }
        public override UserInfoData GetUserInfo(string useruniquename)
        {
            ...connect the access database
            ...get the username for the useruniquename here .. the useruniquename is from ListUserUniqueName()
            return new UserInfoData(useruniquename,username,isadmin);
        }
        public override string[] ListUserUniqueName()
        {
            ...connect the access database
            ...select all user primarykey (id,loginname,email or any unique thing) and return .
        }
        public override bool IsUserNickNameExists(string nickname)
        {
            ...connect the access database
            ...find whether the nickname is registered.
        }
    }
     
    If you website use custom authentication way (for example, you use the cookie) ,
     please create a class that implement the CuteChat.IUserIdentityAdapter
     
    for example:
     
    public class MyUserAdapter : IUserIdentityAdapter
    {
        public string GetCurrentUserUniqueName(HttpContext context)
        {
            HttpCookie cookie=context.Request.Cookies["MyUserInfo"];
            if(cookie==null)return null;
            string username=cookie["UserName"];
            if(username==null||username=="")return null;
            return null;
        }
        public bool IsAdministrators(string useruniquename)
        {
             ...connect to access database , find whether the user is site administrator
        }
    }
     
    When these are done , you must configurate it in web.config :
     
    <cuteChat ... >
        <providers defaultProvider="MyProvider">
            <provider name="MyProvider" sqlDataProviderType="MyNamespace.MyDataProvider,MyDllName"
                    userIdentityAdapterType="MyNamespace.MyUserAdapter,MyDllName" />
        </providers>
    </cuteChat>
     
    Reards , Terry .
View Complete Thread