Re: ChatProvider examples

  •  06-04-2010, 11:22 AM

    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>

View Complete Thread