When my VPN client connects to my VPN server, it creates a .PBK connection, but when i trying to create another connection with another IP, it throws me
System.ArgumentException: 'ConnectionName' already exists in the phone book.
I know i can create different connection name each time i trying to connect, but over time there will be too much unnecessary connections, how can i remove my connection via DotRas or manually?
This folder is totally clear. Don't know what to do.
%AppData%\Roaming\Microsoft\Network\Connections\Pbk
A
RasCollection
, which is whatRasPhoneBook.Entries
is, provides several methods that can be used. In the end, it is anICollection
/IEnumerable
.To remove items, one can use
Remove()
given aRasEntry
,RemoveAt()
given an index, orClear()
to remove everything.Additionally,
RasEntryCollection
providespublic bool Remove(string name)
which one can use to remove an entry given its name.Source: I needed to create a VPN software recently. Lack of documentation did not help.