I usually like to do it the hard way, just to get a feel of what you can do!
In ASP.net there is probably a really simple way Forms authentication etc. but this is what I have.
I know from previous experience that you should never save a Cookie that contains a password, so how to connect a session to a cookie when the user accesses the website, with saved cookies information.
I though about using a Guid, in the cookie, and then check the database to see if that guid is available, but this could be a sort of password like effect.
Here is my code. Private Sub Login1_LoggingIn(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.LoginCancelEventArgs) Handles Login1.LoggingIn
Dim mDbase As New SQL("<Server>", "<Database>", "", "", True)
Dim mUserItem As UserItem = mDbase.Record.Item("SELECT TOP 1 Username, First, Surname, AccessLevel, LastVisited FROM TBLUsers WHERE Username='" & Me.Login1.UserName & "' AND Password='" & Me.Login1.Password & "'", GetType(UserItem))
If mUserItem IsNot Nothing Then
If Me.Login1.RememberMeSet = True Then
'Dim mGuid As Guid = System.Guid.NewGuid
'Create cookie data
If Session("User") Is Nothin
View Complete Post