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

  •  05-05-2010, 3:55 PM

    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 Complete Thread