View previous topic :: View next topic |
Author |
Message |
Kushal
Joined: 11 May 2018 Posts: 52
|
Posted: Mon May 14, 2018 1:31 pm Post subject: StartBackgroundReauthentication - How? |
|
|
My code is as follows (in VB.NET / program.vb Main()):
Code: |
' check if there is an installed license for the application
'
_license = _licenseProvider.GetLicense()
' start a background thread to check with the authentication server that
' the license authentication (if any) is still valid
'
If _licenseProvider.IsValid(_license) Then
_licenseProvider.StartBackgroundReauthentication()
End If
' if there is no installed license then display the evaluation dialog until
' the user installs a license or selects Exit or Continue
'
While Not _licenseProvider.IsValid(_license)
Dim evaluationMonitor As New RegistryEvaluationMonitor("2018")
Dim evaluationDialog As New EvaluationDialog()
evaluationDialog.TopMost = True ' ensure the dialog appears on top of the splash screen
Dim dialogResult As EvaluationDialogResult = evaluationDialog.ShowDialog(evaluationMonitor)
Select Case dialogResult
Case EvaluationDialogResult.Continue
Exit While
Case EvaluationDialogResult.Exit
'Me.HideSplashScreen()
'e.Cancel = True
Exit Sub
'Exit While
Case EvaluationDialogResult.InstallLicense
InstallLicense()
End Select
End While
'Main Application runs here.
Application.Run(New frmLogin)
'Main Application exist, continues here...
_licenseProvider.StopBackgroundReauthentication()
|
Licensing is working fine once a license is installed.
I've deactivated this license and made sure I'm uploading to the remote database.
However, I'm using authentication and the StartBackgroundReauthentication doesn't seem to be doing anything. I've left the app running for a while as well, between two days, but the user is still allowed to run the application!
How does StartBackgroundReauthentication work?
Please provide a sample code if a handler is needed. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue May 15, 2018 10:25 am Post subject: |
|
|
If you use StartBackgroundReauthentication without any parameters then it uses the defaults which are to reauthenticated once every 24 hours. This means the application will only reauthenticate the license if the LastAuthenticationDate in the .lic file (in UTC time) is moire than 24 hours ago. If background reauthentication is working correctly then you should see the license file get updated with a new LastAuthenticationDate after it reauthenticates. You can either change your system clock to force the application to reauthenticate (so you can test it) or you could call the overloaded version of StartBackgroundReauthentication with parameters that allows you specify a shorter a reauthenticationInterval.
BackgroundReauthentication does require an active internet connection and ability to connect to your authentication server. A common mistake to make is people change from running a local authentication server to a public server - but forget to update their application code to point to the new server. If the old local authentication server is running then it will still happily authenticate license keys (even though you have invalidated the license on the new authentication server) _________________ Infralution Support |
|
Back to top |
|
|
|