views:

41

answers:

2

I have a LoginControl that works great, however, I want it to store more information than just being authenticated or not. I would like to store the UserID of the user so when they make changes I can call that UserID and record that they made the changes.

Here is my code.

 Dim db As New DataClassesDataContext

        Dim User = (From UserTable In db.Users _
                    Select UserTable _
                    Where UserTable.Active = True And _
                    UserTable.Name = LoginControl.UserName And _
                    UserTable.Password = RC.CryptedText _
                    )
        If User.Count = 1 Then
            e.Authenticated = True
        Else
            e.Authenticated = False
        End If

I just want to be able to call the UserID later, I'm able to login and access the pages fine, but something like

 Session("UserID") = LoginControl.UserName

Would be great as long as the session doesnt get cleared.

+1  A: 

I would strongly recommend you use the built-in Membership and Role Manager APIs for anything related to security and user management. It's quite easy to extend the model, and add addtional properties to your user objects with Profiles.

Jakob Gade
"Quite easy to extend"? You'd be the first person i know to think so. :)
RPM1984
Thanks. :) I guess I meant adding user specific data is pretty easy with the Membership/Profiles providers. I even rolled my own implementation of the Roles provider at some point, that really was pretty simple.
Jakob Gade