This project is read-only.

Custom Rasphonebook connection

Dec 5, 2009 at 12:37 AM


Ive created an app for work as we support a large number of clients with a mad amount of different vpn, rdp and other connections. Im been using dotras to access my vpn connections and display them in a dropdown box - one click easy launch - very useful.

After a number of requests and now encouragement from management I have edited the tool to work on the server.

Everything like the rdp connections & database info works fine but I cant figure out how to use a phonebook from the apps location. Help please!

I now have it waiting for this one change. I have copied my phonebook to the directory path and I want the app to access that one on the server - not the users personal one - is there a way for it to do this?

Dec 5, 2009 at 3:53 AM

It's not hard to do...

string someCustomPath = "C:\\YourAppPath\\YourPhoneBook.pbk";

RasPhoneBook pbk = new RasPhoneBook();

// Do whatever you want to with the phone book the same as you normally would.

As for dialing the connections you don't need to do anything different other than changing the path of the phone book on the component.

RasDialer dialer = new RasDialer();
dialer.EntryName = "Your Entry Name";
dialer.PhoneBookPath = someCustomPath;

// You can now dial the connection from that phone book.

One of the side effects of using a custom phone book path is you won't see the entries in the phone book show up in the Network Connections window. So don't be alarmed when you no longer see it showing up, that window only monitors the users and all users phone books on the file system.

Dec 5, 2009 at 11:16 AM

Thanks, I knew it was simple but it was escaping me for some reason - and I couldnt find a full example for the life of me :P

Its saturday now so i cant test this part but maybe you know already. When my app is now launched form a shared server location with its own vpn connections listed - will the username & password s that are in the connections be there when they are launched by each user or will it be the same situation where the connections are listed but the credentials are missing like when you copy the rasphone.pkb to another machine?

Dec 5, 2009 at 7:18 PM

I believe when the credentials are stored by Windows, they're stored on the machine that stored them. So if you've got 2 machines and a user authenticates on machine A and then runs the application on machine B his credentials will still stored on machine A and B won't be able to access them.

However, you can always write your own system for storing the credentials that can be transported across machines and pass those credentials into the dialer yourself. You can do whatever you want with them then, but you will also have to deal with ensuring the credentials are secure to prevent unauthorized access. Say someone finds your credential store and they're unencrypted, next thing you know someone who wouldn't have access now has full rights into the remote system. That sort of scenario.

Hope that helps.