private void Master(string _server) { // Connection Parameters string ServerAddress = _server; RasVpnStrategy strategy = RasVpnStrategy.SstpOnly; RasDevice device = RasDevice.Create("SSTP", RasDeviceType.Vpn); bool useRemoteDefaultGateway = true; // Create entry RasEntry entry = RasEntry.CreateVpnEntry(ConnectionName, ServerAddress, strategy, device, false); entry.DnsAddress = IPAddress.Parse("8.8.8.8"); //entry.IPAddress = IPAddress.Parse("219.100.37.219"); entry.EncryptionType = RasEncryptionType.Require; entry.EntryType = RasEntryType.Vpn; entry.Options.RequireDataEncryption = false; entry.Options.UseLogOnCredentials = false; entry.Options.RequireMSChap2 = false; entry.Options.RemoteDefaultGateway = useRemoteDefaultGateway; entry.Options.SecureFileAndPrint = true; entry.Options.SecureClientForMSNet = true; entry.Options.ReconnectIfDropped = false; //entry.Options.RegisterIPWithDns = true; // Get phone book (list of connetions) path string path = RasPhoneBook.GetPhoneBookPath(RasPhoneBookType.User); // Load RasPhoneBook rpb = new RasPhoneBook(); rpb.Open(path); // Check for existance of the same connection if (!rpb.Entries.Contains(entry.Name)) { rpb.Entries.Remove(entry.Name); } rpb.Entries.Add(entry); // Set user and password entry.ClearCredentials(); }