I am using vb.net with the DotRas SDK https://archive.codeplex.com/?p=dotras I have a problem, if I try to execute the example, I always get the error "The value 'gre' is not supported for conversion."
It must be an error with the call
RasDevice.GetDevice
The complete call is:
Dim entry As RasEntry = RasEntry.CreateVpnEntry(EntryName, IPAddress.Loopback.ToString(), RasVpnStrategy.Default, RasDevice.GetDeviceByName("(PPTP)", RasDeviceType.Vpn))
Has anyone an idea, what the problem could be, or how it can be fixed?
I am using Windows Server 2016 64Bit
Thanks!
Edit:
Public Class MainForm
Public Const EntryName As String = "VPN Connection"
Private connectionHandle As RasHandle
Private Sub CreateEntryButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreateEntryButton.Click
' This opens the phonebook so it can be used. Different overloads here will determine where the phonebook is opened/created.
Me.AllUsersPhoneBook.Open()
Dim device = RasDevice.GetDeviceByName("(PPTP)", RasDeviceType.Vpn)
Dim entry = RasEntry.CreateVpnEntry(EntryName, IPAddress.Loopback.ToString(), RasVpnStrategy.Default, device)
' Add the new entry to the phone book.
Me.AllUsersPhoneBook.Entries.Add(entry)
End Sub
Unfortunately the old API cannot handle unexpected values coming from Windows in this are of the newer types of devices.
You will need to likely upgrade to the 2.0 version that does support it (however they are in preview right now).
The project site also moved to GitHub at https://github.com/winnster/DotRas if you’re interested.