what is the best way to have the user credentials saved somewhere
so that he doesn’t have to type his login pw each time the page is reloaded by the user
in a webcookie with timeout or in a session property ?
thanks
what is the best way to have the user credentials saved somewhere
so that he doesn’t have to type his login pw each time the page is reloaded by the user
in a webcookie with timeout or in a session property ?
thanks
This was exactly the example I submit when the Year of Code topic was Web.
If you find my implementation useful, feel free to buy me a coffee.
in one of my older personal projects
i use this in the login window to fill the secret,
and if it is ok i updated the Cookie.
WebPageLogin Opening Event
Sub Opening() Handles Opening
System.DebugLog CurrentMethodName
#If DebugBuild Then
TextFieldKey.Text = App.Key
#Else
TextFieldKey.Text = Session.Cookies.Value("Key")
#EndIf
End Sub
Ok Button Pressed Event
Sub Pressed() Handles Pressed
If TextFieldKey.Text.Compare(App.Key, ComparisonOptions.CaseSensitive) = 0 Then
Session.Cookies.Set("Key", TextFieldKey.Text, DateTime.Now + New DateInterval(0,0,7), "", "", True)
Self.Close
Session.LoggedIn = True
WebPageStart.Show
Else
'Wrong
Attempts = Attempts + 1
If Attempts> 3 Then
Me.Enabled = False
TextFieldKey.Enabled = False
End If
End If
End Sub