'''
''' Store information in session variable in loginSucceeded event.
''' This event is raised after user has successfully logged-in
''' Instead of creating a where string from database you might choose other
''' information to store (like time of sign in, for example).
'''
Protected Sub SignIn_LoginSucceeded(ByVal sender as Object, ByVal e as System.EventArgs) Handles Me.LoginSucceeded
' [BEGIN]: adding more info to session
Dim userId As String = BaseClasses.Utils.SecurityControls.GetCurrentUserID()
' Create where string
Dim whereStr as String = ${${Table Name}ClassName}.${UserId Field}.UniqueName & " = " & "'" & userId & "'"
' Create the order by string.
Dim orderBy As BaseClasses.Data.OrderBy = Nothing
Dim myRecord As ${${Table Name}RecordClassName} = ${${Table Name}ClassName}.GetRecord(whereStr, orderBy)
' Set the extra information in the Session variable as shown below.
' Replace FirstName and LastName by you field names
' where FirstName and LastName are the names of the cloumns that contiain the first name and the last name
' Dim firstName As String = myRecord.FirstName
' Dim lastName As String = myRecord.LastName
' System.Web.HttpContext.Current.Session("firstName") = firstName
' System.Web.HttpContext.Current.Session("lastName") = lastName
' [END]: adding more info to session
End Sub
|