cant get this working -- Operator console does not connect

Last post 05-05-2010, 3:55 PM by xaanix. 7 replies.
Sort Posts: Previous Next
  •  04-22-2010, 4:08 PM 60329

    cant get this working -- Operator console does not connect

    I am attempting to integrate cute live support for my intranet hosted website, running on framework 3.5 (vb.net)
     
    My solution contains one web application project.
     
    I have downloaded the cuteLiveSupport standalone version and performed the following:
    1. copied the DLL files from the standalone's \bin folder into my project's \bin folder,
    2. copied the CuteSoft_Client folder to my project root. 
    3. added a global.asax.vb file to my project, (more on this soon), and implemented the functions required, according to the integration examples cutesoft has posted online (more on this later)
    4. added the <script> lines for the monitor and the chat button.
    5. published to my staging webserver
     
    What works:
    I can go to my staging webserver and i can see the chat button and click it and fill out an offline feedback without error.  
     
    What doesnt work:
    I cannot log in as an operator using the thick client, i receive the following error
    Failed to connect chat service:  System.Exception: CONNECTION:ERROR,Require Agent   at LiveSupport.ChatClient.Connect(Boolean now)   at LiveSupport.MyApp.Run()
     
    I have since modified the global.asax file in an attempt to bruteforce it to validate the login (hardcoded the login and always return true in 
    ValidateUser() and always set admin to true in GetUserInfo()
     
    I have been going back and forth with support (eric) for 3 days without a resolution. I think the documentation for this product badly needs to be updated.  I really want to use this product because it is far cheaper than other products in this space.
     
    I have standalone configured, and it works fine (using the same database).  What am i missing?
     
     
  •  04-22-2010, 4:12 PM 60330 in reply to 60329

    Re: cant get this working -- Operator console does not connect

    my bruteforced global.asax.vb file is as follows. 
     

    Imports System.Web.SessionState

    Imports CuteChat

     

    Public Class Global_asax

        Inherits System.web.httpApplication

     

        Private Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)

            ChatProvider.Instance = New AspNetChatProvider()

            ChatSystem.Start(New AppSystem())

        End Sub

     

        Private Shared CuteChatConnectionStringConfigName As String = "CuteLiveSupportConnectionString"

     

        Public Function GetConnectionString(ByVal reserved As String) As String

            Return System.Web.Configuration.WebConfigurationManager.ConnectionStrings(CuteChatConnectionStringConfigName).ConnectionString

        End Function

     

        Public Class AspNetChatProvider

            Inherits ChatProvider

     

            Public Overloads Overrides Function GetConnectionString() As String

                Return System.Web.Configuration.WebConfigurationManager.ConnectionStrings(CuteChatConnectionStringConfigName).ConnectionString

            End Function

     

            Public Overloads Overrides Function GetLogonIdentity() As AppChatIdentity

                Return New AppChatIdentity("orlandoj", False, "orlandoj", HttpContext.Current.Request.UserHostAddress)

            End Function

     

            Public Overloads Overrides Function FindUserLoginName(ByVal nickName As String) As String

                Return "orlandoj"

            End Function

     

            Public Overloads Overrides Function GetUserInfo(ByVal loginName As String, ByRef nickName As String, ByRef isAdmin As Boolean) As Boolean

                nickName = "orlandoj"

                isAdmin = True

                Return True

            End Function

     

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

                System.Web.Security.FormsAuthentication.SetAuthCookie("orlandoj", False)

                Return True

            End Function

        End Class

     

    End Class



     

     

     

     
  •  04-23-2010, 12:34 AM 60338 in reply to 60330

    Re: cant get this working -- Operator console does not connect

    Hi xaanix,
     
    Try
     
    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>  
    Regards,
     
    ken
  •  04-23-2010, 1:03 PM 60356 in reply to 60338

    Re: cant get this working -- Operator console does not connect

    This worked, thanks!
     
  •  04-23-2010, 3:49 PM 60357 in reply to 60356

    Re: cant get this working -- Operator console does not connect

    In GetLogonIdentity(), is there some recommended way to differentiate if the request is originating from the web or from the operator thick client?
     
    the reason i ask is that for web visitors, i have a specific authentication method i want to call (which checks an ecrypted cookie to get their userID) but for the operator thick client, i want all actions to be based on their domain account.  I intend to use an LDAP query for validation).
     
    the problem is that in subsequent calls to GetLogonIdentity from the thick client, i don't have any way to differentiate the two.  I tried using context.request.url.requesturi, but both web and thick client requests use the same URL's sometimes (such as chatajax.ashx)
  •  05-04-2010, 3:12 AM 60663 in reply to 60357

    Re: cant get this working -- Operator console does not connect

    xaanix:
    In GetLogonIdentity(), is there some recommended way to differentiate if the request is originating from the web or from the operator thick client?
     
    the reason i ask is that for web visitors, i have a specific authentication method i want to call (which checks an ecrypted cookie to get their userID) but for the operator thick client, i want all actions to be based on their domain account.  I intend to use an LDAP query for validation).
     
    the problem is that in subsequent calls to GetLogonIdentity from the thick client, i don't have any way to differentiate the two.  I tried using context.request.url.requesturi, but both web and thick client requests use the same URL's sometimes (such as chatajax.ashx)
     
    Hi xaanix,
     
    The code I provided just an example, you can integrate with your own membership. Please refer to below link step 4.
     
     
    Regards,
     
    ken
  •  05-05-2010, 2:25 PM 60753 in reply to 60663

    Re: cant get this working -- Operator console does not connect

    public override string GetConnectionString()
    {
            return the connection string , for the CuteChat
    }
    // no problems with this one 
     
    public override string FindUserLoginName(string nickName)
    {
            find the login username from the display name or null if the user is not found.
    }
    // is it required i override this? where does it appear in the application?  Can i safely assume this is just for cosmetic purposes?
     
    public override AppChatIdentity GetLogonIdentity()
    {
        need to find the information of current user. Return null if user is anonymous.
        string loginname=...
        string nickname=...
        return new AppChatIdentity(nickname, false, ToUserId(loginname), HttpContext.Current.Request.UserHostAddress);
    }
    // This function is giving me major problems.  I want to support 2 different authentication mechanisms, one for web users and the other for thick client users.  In this function for web users i want to return the current logged in user.  assume i'm using basic authenticaiton and i'm grabbing Server Variable "LOGON_USER" which contains an ID like 'orlandoj'.  My problem is that while this works fine for web users who will be authentication and thus the LOGON_USER variable will be set before your code can run, the function also gets called for thick client users after the thick client loads wend web service request are called from the thick client.  This is a major problem because the thick client cannot use the server variable as it may not have been set.   The problem i'm having is that once a user authenticates on the thick client, the thick client itself starts to send web requests, to the webserver.  Those web requests end up triggering calls to this function GetLogonIdentity(), but unlike with a web user the Server variable LOGON_USER is not set. 
     
    Can you comment on the following strategy? assuming calls to validate user actually only originate from the thick client..
    1. set a cookie for example "UserID" in ValidateUser
    2. In GetLogonIdentity, first check if the cookie from (1) above is present, if it is, read the user name from the cookie and use this to create a new appchatidentity object. 
    3. if cookie is not present, try to read my server variable LOGON_USER, if this is set, create a new appchatidentity with that value instead. 
    4. if cookie is not set and LOGON_USER is null or = "", then  return null 
     
    Does this seem reasonable? 
     
    public override bool GetUserInfo(string loginName, ref string nickName, ref bool isAdmin)
    {
           return false , if the loginName is invalid.
           otherwise set the nickName and isAdmin , and return ture
    }
    // this one is pretty straightforward as it is passing in the loginName (login ID) of the user and if it is valid you just set the additional information 
     
    public override bool ValidateUser(string loginName, string password)
    {
            check the username/password . 
            if valid , set the cookie.
    }
    // what cookie??    are you saying the app will read this cookie and use this ID for subsequent thick client requests?   Do i get to pick the cookie name or is the app expecting a specific cookie to be set?
    When testing it seems like this function is only called when the user first authenticates to the thick client.   Is this true?
  •  05-05-2010, 3:55 PM 60754 in reply to 60753

    Re: cant get this working -- Operator console does not connect

    I attempted the strategy above but the cookie is not visible in the webservice requests which come from the thick client after the user logs in initially.
     
    Again i am seeing 2 requests from the thick client before it fails, the first request  seems to call GetUserInfo, then ValidateUser, then GetLogonIdentity.  Since i set the cookie in  ValidateUser, GetLogonIdentity is able to read the cookie.  The second request just seems to call GetLogonIdentity. When i attempt to read the cookie in this request however I am not able.  
    The first request which is able to pull the cookie is accessing:
    httpcontext.Current.Request.Url.AbsoluteUri "http://localhost:4630/helpsite/CuteSoft_Client/CuteChat/SupportService.asmx" String

    The second request which doesnt seem to contain the cookie is:
    httpcontext.Current.Request.Url.AbsoluteUri "http://localhost:4630/helpsite/CuteSoft_Client/CuteChat/ChatAjax.ashx" String

     
     
    For reference, here is my current code: 
     

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

                If Not context Is Nothing Then
                    Dim myLoggedInUser As String = ""
                    Try
                        myLoggedInUser = context.Request.Cookies("LoggedInUser").Value
                    Catch ex As Exception

                    End Try

                    If myLoggedInUser <> "" Then
                        'got user id from cookie
                        Return New AppChatIdentity(myLoggedInUser, False, myLoggedInUser, context.Request.UserHostAddress)
                    Else
                        ' try to get userid from web
                        myLoggedInUser = getLoggedInUser(context)
                        If Not myLoggedInUser Is Nothing AndAlso myLoggedInUser <> "" Then
                            Return New AppChatIdentity(myLoggedInUser, False, myLoggedInUser, context.Request.UserHostAddress)
                        End If
                    End If
                End If

                Return Nothing
            End Function

            Public Overloads Overrides Function FindUserLoginName(ByVal nickname As String) As String
                Return "orlandoj"
            End Function

            Public Overloads Overrides Function GetUserInfo(ByVal loginName As String, ByRef nickName As String, ByRef isAdmin As Boolean) As Boolean
                ' loginName = "orlandoj"
                '   myLoginName = loginName
                nickName = loginName
                isAdmin = True
                Return True
            End Function

            Public Overrides Function ValidateUser(ByVal loginName As String, ByVal password As String) As Boolean
                Dim objPersistCookie As New HttpCookie("LoggedInUser", loginName)
                objPersistCookie.Expires = Now.AddDays(1)
                HttpContext.Current.Response.Cookies.Add(objPersistCookie)
       
                Return True
            End Function

     
     
     
View as RSS news feed in XML