Change ServerAddress

Feb 7, 2011 at 1:45 PM

When a vpn entry is created the serveraddress is specified but I don't see an option to update the server address.  To update the server address I would need to remove the entry and recreate, is that correct?

Coordinator
Feb 7, 2011 at 4:03 PM

No, the server address argument in CreateVpnEntry is named that for ease of use. The data is actually fed into the PhoneNumber property on the class which does have a set accessor available. It's called PhoneNumber because that's what the Windows SDK calls it.

using (RasPhoneBook pbk = new RasPhoneBook())
{
    pbk.Open();

    RasEntry entry = pbk.Entries["VPN Connection"];
    entry.PhoneNumber = "vpnservername";
    entry.Update();
}

If you haven't added the entry to a phone book yet, you can just set the property before adding it. Once it's been added, the item is now on the file system and will need update called to persist it.

Feb 8, 2011 at 3:30 PM

Perfect, thanks!