I am attempting to create a console app to create a VPN connection for my company. I am able to create the VPN connection but unable to set a few of the properties. I want Unencrypted password (PAP) to be true and CHAP and CHAP2 to be false. But, the opposite is happening to those settings. I am using DotRas tools. What am i doing wrong or missing?
string VpnName = "Test VPN";
string Destination = "127.0.0.1";
string PresharedKey = "testkey";
RasPhoneBook PhoneBook = new RasPhoneBook();
PhoneBook.Open();
RasEntry VpnEntry = RasEntry.CreateVpnEntry(VpnName, Destination, DotRas.RasVpnStrategy.L2tpOnly, DotRas.RasDevice.Create(VpnName, DotRas.RasDeviceType.Vpn));
VpnEntry.Options.UsePreSharedKey = true;
VpnEntry.Options.UseLogOnCredentials = false;
VpnEntry.Options.RequirePap = true;
VpnEntry.Options.RequireMSChap = false;
VpnEntry.Options.RequireMSChap2 = false;
PhoneBook.Entries.Add(VpnEntry);
VpnEntry.UpdateCredentials(RasPreSharedKey.Client, PresharedKey);
Console.WriteLine("VPN connection created successfully");