This project is read-only.

Open(string) obsolete

Apr 29, 2013 at 6:13 PM

Im newbie on dotras, and im building an pppoe dialer, all work fine so far, but i keep with this warning message from vs:

Warning 1 'DotRas.RasPhoneBook.Open()' is obsolete: 'This method will be removed in a future version, please use the Open(string) overload to open the phone book.'

Did a search on this forum, but didnt see any topic about this.

Im opening phonebook with


in the warning, i have open(string). this string means a phonebookpath? . I really need to inform a phonebookpath even if code working fine. Anyway to inform a empty string?
Apr 30, 2013 at 1:39 AM
Edited Apr 30, 2013 at 1:41 AM
The old Open() and Open(bool) methods on RasPhoneBook are being removed in the next major release of DotRas as indicated on the home page here. The obsolete warnings are there to inform people they shouldn't be using them, but will still function if you wish to ignore the warnings.
using (RasPhoneBook pbk = new RasPhoneBook())
The above is an example of how you could be using the component.

Edit: I wanted to add, no you cannot pass an empty string into the method and expect it to work. It needs to know where Windows needs to put the file.
Apr 30, 2013 at 4:18 AM
I did that, but if i set phonebook path to, for example, the app directory, i cant see the warning anymore, but my app became unable to create a new broadband connection when it needs. Any tips on how to do this? I need to set the location of Windows all users rasphonebook?
Apr 30, 2013 at 5:19 PM
Windows only monitors phonebook files in two locations to place them into the network connections window, if that's what you were looking at when you said it "became unable to create a new broadband connection". If you've got the entry being placed into a phonebook next to your app, Windows wouldn't know about it to display it, but the entry would still work perfectly fine.

There are also static methods on RasPhoneBook to get access to the default phonebook locations:
string path = RasPhoneBook.GetPhoneBookPath(RasPhoneBookType.AllUsers);
In the above example, path would contain the full path to the All Users profile phonebook file. However, be warned... in Windows 7 and later that file is under protection of the UAC and will require your application to have elevated rights to make changes to it. I would avoid doing that if possible, it makes things quite complicated and you will be on your own there how you want to elevate your app.
Apr 30, 2013 at 10:42 PM
I get it, thank you very much jeff!!
May 1, 2013 at 1:45 AM
jeff, another thing now.

Using a local phonebook work all fine, but, when i close de app and open again, my method to get the active handle then watch with ConnectionWatcher_Connected dont run the routine.

Im geting the handle with RasConnection conn = RasConnection.GetActiveConnections().Where(c => c.EntryName == EntryName).FirstOrDefault(); and updating with ConnectionWatcher.Handle = conn.Handle;
Where var EntryName is the device name.

I hope u can understand what im trying to say.
May 1, 2013 at 3:32 AM
I have absolutely no idea what it is you're trying to say.
May 1, 2013 at 4:38 AM
Nevermind, i got working right! thanks for your kind attention