This project is read-only.

DNS Server for a VPN Connection

Oct 8, 2009 at 11:52 AM

Hello,

how can i get the DNS Server for a connected VPN Connection with VB.Net?

See Sceenshot:

VPN

 

Thanks for Help

Gunter

Oct 8, 2009 at 3:12 PM

Originally I thought it was part of the GetProjectionInfo method on RasConnection, but it looks like that would only return the client and server IP addresses. I haven't got a clue where that information is coming from so it might take me a couple days of digging around in the Windows SDK to find it. If you find something yourself please let me know what it was to save me some time.

This might be able to get you started in your search to find the answer:

' You will need a RasDialer somewhere to be able to use this along with the name or handle of
' which connection you wish to find in the collection.

Dim connection As RasConnection

For Each connection In dialer.GetActiveConnections()
    If connection.Handle = handle Then
        Exit For
    End If
Next

If connection IsNot Nothing Then
    Dim info As RasIPInfo = CType(connection.GetProjectionInfo(RasProjectionType.IP), RasIPInfo)
End If

That will get you the active connections on the machine and the locate one of them in the collection based on the handle. You can substitute the name of the connection there as well since both must be unique. However, if you do use the name you should also ensure the phonebook path matches what you expect since the entry names are only unique for that specific phonebook.

Oct 9, 2009 at 5:22 AM

After some digging it looks like what you're requesting isn't part of the RAS APIs, which is why it isn't already supported by this project. There is a possibility I could add support for it at some point, but as of right now I have other pressing matters I need to take care of first. Here are some links you might be able to make use of to do what you're asking for...

GetAdaptersAddresses Function:

http://msdn.microsoft.com/en-us/library/aa365915(VS.85).aspx

Here's a project on CodeProject you might be able to decipher:

http://www.codeproject.com/KB/IP/Net_Adapter_Info_in_C_.aspx

Good luck!