I re-wrote the global.asax and no longer get the ChatSystem not installed error.
However, when I run a test page, with the embedded messenger chat control in it, I receive the following Java Script errors and nothing displays except the ad that says add Chat to your site.
__cc_urlbase is not defined
_chatEventMap is undefined
Below is the code in my Global.asax
<%@ Application Language="VB" %>
<%@ Import Namespace="CuteChat" %>
<script runat="server">
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
If Not Roles.RoleExists("Administrators") Then
Roles.CreateRole("Administrators")
End If
ChatProvider.Instance = New SampleProvider()
ChatSystem.Start(New AppSystem())
End Sub
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application shutdown
End Sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when an unhandled error occurs
End Sub
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when a new session is started
End Sub
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when a session ends.
' Note: The Session_End event is raised only when the sessionstate mode
' is set to InProc in the Web.config file. If session mode is set to StateServer
' or SQLServer, the event is not raised.
End Sub
Public Overloads Function GetConnectionString() As String
Return System.Configuration.ConfigurationManager.AppSettings("ConnectionString")
End Function
Public Overloads Function GetUserInfo(ByVal loginName As String, ByRef nickName As String, ByRef isAdmin As Boolean) As Boolean
' return false , if the loginName is invalid.
' otherwise set the nickName and isAdmin , and return ture
Dim user As System.Web.Security.MembershipUser = System.Web.Security.Membership.GetUser(nickName, False)
If user IsNot Nothing AndAlso user.IsApproved Then
nickName = user.UserName
isAdmin = Roles.IsUserInRole(user.UserName, "Admin")
Return (True)
End If
Return (False)
End Function
Public Overloads Function FindUserLoginName(ByVal nickName As String) As String
'find the login username from the display name or null if the user is not found.
Dim user As System.Web.Security.MembershipUser = System.Web.Security.Membership.GetUser(nickName, False)
If user IsNot Nothing AndAlso user.IsApproved Then
Return (user.UserName)
End If
Return (Nothing)
End Function
Public Overloads Function GetLogonIdentity() As AppChatIdentity
Dim context As HttpContext = HttpContext.Current
If context IsNot Nothing Then
If context.User.Identity.IsAuthenticated Then
Dim loginName As String = context.User.Identity.Name
Dim cachekey As String = "NickName:" & loginName
Dim userid As String = GetUserID(loginName)
Dim nickName As String = Nothing
Dim isAdmin As Boolean = Roles.IsUserInRole("Admin")
Dim exists As Boolean = GetUserInfo(loginName, nickName, isAdmin)
If Not exists Then
Return (Nothing)
End If
Return (New AppChatIdentity(nickName, False, userid, context.Request.UserHostAddress))
End If
End If
Return (Nothing)
End Function
Public Function GetUserID(ByVal loginName As String) As String
Dim MyUser As MembershipUser = Membership.GetUser(loginName)
Return MyUser.ProviderUserKey.ToString
End Function
Public Overloads Function ValidateUser(ByVal loginName As String, ByVal password As String) As Boolean
' check the username/password . if valid , set the cookie.
If Not System.Web.Security.Membership.ValidateUser(loginName, password) Then
Return (False)
End If
System.Web.Security.FormsAuthentication.SetAuthCookie(loginName, False, HttpRuntime.AppDomainAppVirtualPath)
Return (True)
End Function
Public Function GetUserName() As String
Dim CurrentContext As HttpContext = HttpContext.Current
If CurrentContext.Request.IsAuthenticated Then
Dim MyUser As MembershipUser = CurrentContext.User
Return MyUser.UserName
Else
Return Nothing
End If
End Function
</script>