This project is read-only.

RasConnection.GetActiveConnectionByName always return "nothing"?

Feb 3, 2011 at 1:07 PM

Hello!

 

In a VPN client project I have the code below to disconnect button:

1        If (Me.Dialer.IsBusy) Then
2            Me.Dialer.DialAsyncCancel()
3        Else
4            Dim entryname As String = "TestVPN"
5            Dim mypbk = RasPhoneBook.GetPhoneBookPath(RasPhoneBookType.AllUsers).ToString()
6            Dim myconn As RasConnection = RasConnection.GetActiveConnectionByName(entryname, mypbk)
7            If (myconn IsNot Nothing) Then
8                myconn.HangUp()
9            End If
10        End If

 

In line 6 of the code, the application always return "Nothing" value. What I doing wrong? Could you help me?

Thanks for the community and Dotres project.

Regards,

Eduardo.

 

 

 

 

 
 


Feb 3, 2011 at 3:06 PM

More than likely you've got path to the wrong phonebook being passed into the method, don't forget Windows uses two phonebooks. The comparison checks inside the method default to StringComparison.CurrentCultureIgnoreCase unless you call the overload and specify the StringComparison enum yourself.

Feb 3, 2011 at 3:51 PM

JEFF... YOU'RE THE MAN! As says in São Paulo! hahahahahaha

Ok... I foud the correct phonebook and now it's working properly!

Thank you very much for Help.... When I finish this VB.Net VPN Client, can I share this full code in this board??

Thank you very much.

Regards,

Eduardo.

Feb 3, 2011 at 6:19 PM

Well, there is no way to upload the files to the forum. You'd probably be better off putting it on a blog and linking to it from over here. You'll be able to put more info and talk about the app as well then if you did.