Re: Need the code for my authentication

  •  09-29-2009, 5:47 PM

    Re: Need the code for my authentication

    hello .
    If you need help, I see if I can help you
    I have done so: in a web aspx, scritp for load
    in master page .
     
    function load() {
     
    Chat_StartPartialMessenger();

    }

    var urlbase = __cc_urlbase; //__cc_urlbase='CuteSoft_Client/CuteChat/' , defined in IntegrationUtility.js.aspx

    function OpenOldMessenger() {

    window.open(urlbase + "Messenger.aspx", "", 'status=1,width=300,height=500,resizable=1');

    }

    function OpenNewMessenger() {

    window.open(urlbase + "NewMessenger.aspx", "", 'status=1,width=720,height=560,resizable=1');

    }

    function JumpNewMessenger() {

    location.href = urlbase + "NewMessenger.aspx";

    }

    function ShowNewMessenger() {

    //call the function in IntegrationUtility.js.aspx

    Chat_OpenMessenger();

    }
     
    I took a class in VB that you can still translate:
     

    Imports System.IO

    Imports System.Security

    Imports System.Security.Principal

    Imports System.Threading

    Imports System.Web

    Imports System.Web.Security

    Imports Microsoft.VisualBasic

    Imports CuteChat

    Public Class AspNetChatProvider

    Inherits ChatProvider

    Private Shared CuteChatConnectionStringConfigName As String = "xxxxxxxx name connection web config"

    Public Overloads Overrides Function CreateDataManagerInstance(ByVal portal As AppPortal) As AppDataManager

    Return New MyDataManager(portal)

    End Function

    Public Class MyDataManager

    Inherits AppDataManager

    Public Sub New(ByVal portal As AppPortal)

    MyBase.New(portal)

    End Sub

    Public Overloads Overrides Sub AddIgnore(ByVal identity As ChatIdentity, ByVal userid As String)

    MyBase.AddIgnore(identity, userid)

    ' intercetp look user in messenger

    Dim exeuser As New utente

    ' my function excute other operation in my data base

    exeuser.blocca_utente_cutechat(identity.DisplayName, userid)

    End Sub

    Public Overloads Overrides Sub RemoveIgnore(ByVal identity As ChatIdentity, ByVal userid As String)

    MyBase.RemoveIgnore(identity, userid)

    ' intercetp unlook user in messenger
    Dim exeuser As New utente

    ' my function excute other operation in my data base

    exeuser.sblocca_utente_cutechat(identity.DisplayName, userid)

    End Sub

    End Class

    Public Overloads Overrides Function GetConnectionString() As String

    Return System.Configuration.ConfigurationManager.ConnectionStrings(CuteChatConnectionStringConfigName).ConnectionString

    End Function

    Public Overloads Overrides Function GetLogonIdentity() As AppChatIdentity

    Try

    Dim user As System.Web.Security.MembershipUser = System.Web.Security.Membership.GetUser()

    Dim exe As New utente

    ''' other my function

    'If exe.pending_sms(exe.get_iduser(user.UserName)) = True Then

    ' Return Nothing

    'Else

    If user IsNot Nothing AndAlso user.IsApproved Then

    Return New AppChatIdentity(user.UserName, False, ToUserId(user.UserName), HttpContext.Current.Request.UserHostAddress)

    End If

    Return Nothing

    'End If

    Catch ex As Exception

    Return Nothing

    End Try

    End Function

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

    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 Overrides Function GetUserInfo(ByVal loginName As String, ByRef nickName As String, ByRef isAdmin As Boolean) As Boolean

    Dim user As System.Web.Security.MembershipUser = System.Web.Security.Membership.GetUser(loginName, False)

    If user IsNot Nothing AndAlso user.IsApproved Then

    nickName = user.UserName

    isAdmin = Roles.IsUserInRole(user.UserName, "Administrators")

    Return True

    End If

    Return False

    End Function

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

    If Not System.Web.Security.Membership.ValidateUser(username, password) Then

    Return False

    End If

    System.Web.Security.FormsAuthentication.SetAuthCookie(username, False, HttpRuntime.AppDomainAppVirtualPath)

    Return True

    End Function

    End Class


     
     
     
     
View Complete Thread