What code should I use so that a registered user can automatically log-in without typing his username and password again?
Printable View
What code should I use so that a registered user can automatically log-in without typing his username and password again?
you can write a cookie first time he logs in. Next time you first check the cookie, if it's not there you send him to the login page, if not he's logged in automatically.
You might want to ask the user if he wants to log in automatically at his next visit, cause in case that person is sharing his computer, he might prefer to log in at every visit.
hope this helped!
if you want more details let me know, I could send you some code.
I'm using a vb app to login, get a cookie from the server, then send more data to the server (form data and files). The site requires login, but I don't want to continually send my user and password. Instead, if I send a cookie for the session, I can remain valid in the server's session table.
I get the cookie using:
Private Sub web1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If (pDisp Is web1.Object) Then
Debug.Print "Web document is finished downloading"
txtCK.Text = web1.Document.cookie
Dim cook, st1 As String
Dim cklngth, ck2 As Integer
cook = txtCK.Text
End If
Which displays the cookie in the text box txtCK. I can use the cookie to send more form data, but when I try to send multi-part form data (form data and a file) I cannot get past the login screen. I think I need help on building the POST string and the exact location and syntax of the cookie info.