Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Login anomaly

2 REPLIES 2
Reply
Message 1 of 3
JamieVJohnson2
563 Views, 2 Replies

Login anomaly

My standard works 99% of the time login code is performing fine on most machines.  However I have this one machine that fails first attempt with the following error report, but the second attempt (which prompts the user for credentials, the same credentials used on first attempt) succeeds.  The oddity is the error.  Why is it trying to compare a version 1.0.0.0????  This is 2017, I have no code or dlls at version 1.0.0.0.  I think this may be a 'default' version number being sent in erroneously.

 

System.Exception: InvalidServer

1.0.0.0 is not compatible with the following applications on CADServer:

 

   Vault Basic Server 22.1.2.10

   Vault Workgroup Server 22.1.2.10

   Vault Collaboration Server 22.1.2.10

   Vault Professional Server 22.1.2.10

 

Has anybody seen this before.

jvj
2 REPLIES 2
Message 2 of 3

Hi Jamie,

 

I am able to recreate the behavior where the first time I log in I get a license error but when I try it again the error does not occur and I get a connection. I am using the ItemEditor SDK sample. It uses this code to log in:

 

VDF.Vault.Forms.Settings.LoginSettings settings = new VDF.Vault.Forms.Settings.LoginSettings();

VDF.Vault.Currency.Connections.Connection connection = VDF.Vault.Forms.Library.Login(settings);

 

 

I am not seeing the InvalidServer error yet. Can you share your code that is getting that error?

 

Thanks,

Wayne 



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Message 3 of 3

When accessing vault I use the VaultConnection property to lazy-load vault.  So the first point of access is my private variable vConnection, and determining if it exists, is logged in, and can be logged into and out of.  My newest log into vault command offers the user a chance to change the login variables, but defaults to the same credentials otherwise.  For the user in question, the first auto attempt throws an error, and the second manual attempt succeeds.  Same login command either way.

 

 

 Shared Property VaultConnection As Vault.Currency.Connections.Connection
        Get
            If vConnection Is Nothing Then
                vConnection = LoginVault()
                'vConnection = Vault.Forms.Library.Login(Nothing)
                If vConnection Is Nothing Then
                    MsgBox("You must log into vault to continue.")
                    RaiseEvent Shutdown()
                    Return Nothing
                End If
            End If
            If vConnection.IsConnected = False Then
                vConnection = LoginVault() 'Vault.Forms.Library.Login(Nothing)
            End If
            Return vConnection
        End Get
        Set(value As Vault.Currency.Connections.Connection)
            If value IsNot Nothing Then
                vConnection = value
            End If
        End Set
    End Property

    Public Shared Function LoginVault() As Vault.Currency.Connections.Connection
        Dim sec As Security = Security.Instance
        Dim strVaultServer As String = sec.VaultServer
        Dim strVault As String = sec.VaultVault
        Dim strUser As String = sec.VaultViewerUsername
        Dim strPassword As String = sec.VaultViewerPassword
        Dim lgResults As Vault.Results.LogInResult =
               VDF.Vault.Library.ConnectionManager.LogIn(strVaultServer, strVault, strUser, strPassword, VDF.Vault.Currency.Connections.AuthenticationFlags.ReadOnly, Nothing)
        If lgResults.Success = True Then
            Return lgResults.Connection
        Else
            Dim strErrorMessages As String = String.Empty
            For Each ErrMsg As KeyValuePair(Of Vault.Results.LogInResult.LogInErrors, String) In lgResults.ErrorMessages
                strErrorMessages += Vault.Results.LogInResult.LogInErrors.GetName(GetType(Vault.Results.LogInResult.LogInErrors), ErrMsg.Key) & vbCr & ErrMsg.Value & vbCr
            Next
            MsgBox("Unable to log into vault." & vbCr & strErrorMessages)
            Dim ehLogin As New ErrorHandler(New System.Exception(strErrorMessages & strVaultServer & " ; " & strVault & " ; " & strUser & " ; " & strPassword))
            ehLogin.QuietlyHandleIt()
            Try
                If MsgBox("Attempt manual login?", MsgBoxStyle.YesNo, "Vault Connection") = MsgBoxResult.Yes Then
                    Dim conn As Vault.Currency.Connections.Connection = Nothing
                    conn = LoginVaultManually()
                    Return conn
                End If
            Catch ex As Exception
                Dim eh As New ErrorHandler(ex)
                eh.HandleIt()
            End Try
        End If
        Return Nothing
    End Function

    Public Shared Function LoginVaultManually() As Vault.Currency.Connections.Connection
        Dim sec As Security = Security.Instance
        Dim strVaultServer As String = InputBox("Vault Server", "Log Into Vault Manually", sec.VaultServer)
        Dim strVault As String = InputBox("Vault", "Log Into Vault Manually", sec.VaultVault)
        Dim strUser As String = InputBox("Vault Username", "Log Into Vault Manually", sec.VaultViewerUsername)
        Dim strPassword As String = InputBox("Vault Password", "Log Into Vault Manually", sec.VaultViewerPassword)
        Dim lgResults As Vault.Results.LogInResult =
               VDF.Vault.Library.ConnectionManager.LogIn(strVaultServer, strVault, strUser, strPassword, VDF.Vault.Currency.Connections.AuthenticationFlags.ReadOnly, Nothing)
        If lgResults.Success = True Then
            Return lgResults.Connection
        Else
            Dim strErrorMessages As String = String.Empty
            For Each ErrMsg As KeyValuePair(Of Vault.Results.LogInResult.LogInErrors, String) In lgResults.ErrorMessages
                strErrorMessages += Vault.Results.LogInResult.LogInErrors.GetName(GetType(Vault.Results.LogInResult.LogInErrors), ErrMsg.Key) & vbCr & ErrMsg.Value & vbCr
            Next
            MsgBox("Unable to manually log into vault." & vbCr & strErrorMessages)
            Dim ehLogin As New ErrorHandler(New System.Exception(strErrorMessages & strVaultServer & " ; " & strVault & " ; " & strUser & " ; " & strPassword))
            ehLogin.QuietlyHandleIt()
        End If
        Return Nothing
    End Function
jvj

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report