This project is read-only.

ArgumentException when redial again

May 24, 2013 at 1:41 AM
Edited May 24, 2013 at 1:42 AM
I am going to make a VPN client, with PPTP,L2TP,SSTP choice.

the client works well at the first time, but it fail to dial again when open this software second time, it shows:
System.ArgumentException: 'entry' must have the PhoneNumber, DeviceType, DeviceName, FramingProtocol, and EntryType properties set as a minimum.
I will update the entry if it exist with the new server address, and devicetype, here is my code:
        If (RasPhoneBook2.Entries.Contains(EntryName)) Then
            entry = RasPhoneBook2.Entries(EntryName)
            If chbL2TP.Checked = True Then
                entry.PhoneNumber = loginserver
                entry.VpnStrategy = RasVpnStrategy.L2tpOnly
            ElseIf chbSSTP.Checked = True Then
                entry.PhoneNumber = loginserver
                entry.VpnStrategy = RasVpnStrategy.SstpOnly
            ElseIf chbSSH.Checked = True Then

                entry.PhoneNumber = loginserver
                entry.VpnStrategy = RasVpnStrategy.PptpOnly
                chbPPTP.Checked = True
            End If
            If chbSSTP.Checked = True Then
                entry = RasEntry.CreateVpnEntry(EntryName, loginserver, RasVpnStrategy.SstpOnly, RasDevice.GetDeviceByName("(SSTP)", RasDeviceType.Vpn))
            ElseIf chbL2TP.Checked = True Then
                entry = RasEntry.CreateVpnEntry(EntryName, loginserver, RasVpnStrategy.L2tpOnly, RasDevice.GetDeviceByName("(L2TP)", RasDeviceType.Vpn))
                entry = RasEntry.CreateVpnEntry(EntryName, loginserver, RasVpnStrategy.PptpOnly, RasDevice.GetDeviceByName("(PPTP)", RasDeviceType.Vpn))
            End If

            ' Add the new entry to the phone book.
        End If
what am I missing?
May 24, 2013 at 1:43 AM
i;ve tried add
and it works for WinXP and Win8, but there is an annoying pop window for the new connection after connected every time in Win7.
Jun 4, 2013 at 4:29 AM
Can anybody help me?
The code works fine for winxp and win8, except win7.
The error will occur even with the administrator role.
Jun 6, 2013 at 6:47 PM
If you mean the NLA in 7, I think you can turn that off with a registry key. Nothing to do with RAS.