ChatProvider examples

Last post 06-07-2010, 2:14 AM by Kenneth. 3 replies.
Sort Posts: Previous Next
  •  06-03-2010, 3:48 AM 61526

    ChatProvider examples

    Has an application with FormsAuthentication login with user data present in a SQL Server 2008.
    I want to use the FormsAuthentication login I use now with CuteChat?
    Do you have a ChatProvider example for that (VB)?

     
    In Membership Database Integration i use the code from "Add web messenger button into web pages", but i have JavaScript error and nothing happens when I click on the link.
     
    In Membership Database Integration i use the code from "Add chat admin button into web pages". I cannot find the folder (Admin) of "
    CuteSoft_Client/CuteChat/"
     
    In Membership Database Integration i use the code from "Add chat rooms into web pages" but the ArrayList is emty?
  •  06-03-2010, 9:47 PM 61546 in reply to 61526

    Re: ChatProvider examples

    Hi kjell.ek,

    Do you have a ChatProvider example for that (VB)? 
    1. <%@ Application Language="VB" %>   
    2. <%@ Import Namespace="CuteChat" %>   
    3.   
    4. <script RunAt="server">   
    5.     Private Sub Application_Start(ByVal sender As ObjectByVal e As EventArgs)   
    6.         ChatProvider.Instance = New AspNetChatProvider()   
    7.         ChatSystem.Start(New AppSystem())   
    8.     End Sub  
    9.        
    10.     Public Class AspNetChatProvider   
    11.         Inherits ChatProvider   
    12.        
    13.         Public Overloads Overrides Function GetLogonIdentity() As AppChatIdentity   
    14.             Dim context As HttpContext = HttpContext.Current   
    15.             'method ToUserId is necessaries   
    16.             Dim userid As String = ToUserId("orlandoj")   
    17.             Return New AppChatIdentity("orlandoj"False, userid, context.Request.UserHostAddress)   
    18.         End Function  
    19.        
    20.         Public Overloads Overrides Function FindUserLoginName(ByVal nickName As StringAs String  
    21.             Return "orlandoj"  
    22.         End Function  
    23.            
    24.         Public Overloads Overrides Function GetUserInfo(ByVal loginName As StringByRef nickName As StringByRef isAdmin As BooleanAs Boolean  
    25.             loginName = "orlandoj"  
    26.             nickName = "orlandoj"  
    27.             isAdmin = True  
    28.             Return True  
    29.         End Function  
    30.        
    31.         Public Overloads Overrides Function ValidateUser(ByVal username As StringByVal password As StringAs Boolean  
    32.             Return True  
    33.         End Function  
    34.              
    35.            
    36.     End Class  
    37.   
    38.           
    39. </script>  
    In Membership Database Integration i use the code from "Add web messenger button into web pages", but i have JavaScript error and nothing happens when I click on the link.
     
    Please post  the full error message here.
     
    In Membership Database Integration i use the code from "Add chat admin button into web pages". I cannot find the folder (Admin) of "
    CuteSoft_Client/CuteChat/"
     
    admin folder in CuteChat is "CuteSoft_Client/CuteChat/ChatAdmin/"
    If you still can not find it. Please download the package below, you can find all folders you need.
     
     
     
    In Membership Database Integration i use the code from "Add chat rooms into web pages" but the ArrayList is emty?
     
    Make sure you have already created some chat rooms. By default CuteChat does not contain a default chat room.
     
    Regards,
     
    ken
  •  06-04-2010, 11:22 AM 61567 in reply to 61526

    Re: ChatProvider examples

    Have now update my global.asax to this, but when i access CuteSoft_Client/CuteChat/ChatAdmin/ i have
    "System.NullReferenceException:" in Function GetConnectionString()
     
    Have this in my web.config:
    <add key="ChattInlogg" value="server=xxx.xxx.xxx.xx,1433;user=xxx;pwd=xxx;database=dragchatt"/>
     
    Do i have wrong ConnectionString?
     
     -----------------------------------------------------------------------

    <%@ Application Language="VB" %>  
    <%@ Import Namespace="CuteChat" %>  

    <script RunAt="server">

        Private Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
            ChatProvider.Instance = New AspNetChatProvider()
            ChatSystem.Start(New AppSystem())
        End Sub

        Public Class AspNetChatProvider
            Inherits ChatProvider

            Public Overrides Function GetConnectionString() As String
                Return System.Configuration.ConfigurationManager.ConnectionStrings("ChattInlogg").ConnectionString
            End Function

            Public Overrides Function GetLogonIdentity() As CuteChat.AppChatIdentity
                Dim context As HttpContext = HttpContext.Current

                'method ToUserId is necessaries
                Dim userid As String = ToUserId("xxxxxxxxxx")
                Return New AppChatIdentity("xxxxxxxxxx", False, userid, context.Request.UserHostAddress)
            End Function
           
            Public Overrides Function FindUserLoginName(ByVal nickName As String) As String
                Return "xxxxxxxxxx"
            End Function

            Public Overrides Function GetUserInfo(ByVal loginName As String, ByRef nickName As String, ByRef isAdmin As Boolean) As Boolean
                loginName = "xxxxxxxxxx"
                nickName = "kjelle"
                isAdmin = True
                Return True
            End Function

            Public Overloads Overrides Function ValidateUser(ByVal username As String, ByVal password As String) As Boolean
                Return True
            End Function

        End Class

    </script>

  •  06-07-2010, 2:14 AM 61601 in reply to 61567

    Re: ChatProvider examples

    Hi kjell.ek,
     
    It just an example to show you the Chat provider format, can not use it directly.
     
    Please refer to http://www.cutesoft.net/ASP.NET+Chat/Developer-Guide/scr/DeploymentIntegration.htm stpe 4 to create your own chatprovider.
     
    you set <add key="ChattInlogg" value="server=xxx.xxx.xxx.xx,1433;user=xxx;pwd=xxx;database=dragchatt"/> in web.config, I think you set in
     
    <appSettings><appSettings/>. So you can get the value like below.
     
    System.Configuration.ConfigurationSettings.AppSettings("ChattInlogg")
     
    Regards,
     
    ken
View as RSS news feed in XML