.NET DotRas vpn connection serverAddress resolving

387 Views Asked by At

I'm currently trying to create VPN connection with c# using DotRas lib. Everything looks quite easy, but I just can't understand how DotRas resolves server address while creating entry.

RasEntry.CreateVpnEntry("EntryName", "ServerAddress", RasVpnStrategy.L2tpOnly, RasDevice);

I saw that when I'm giving IP address and dialing, I'm catching exception

The remote connection was not made because the name of the remote access server did not resolve

When I'm giving unresolved server address, everything works fine !!!!

So my question is: How DotRas resolves serverAddress? I mean to what format? Why it fails when IP is given?

P.S. I've tried to dig in to the DotRas source code, but couldn't find anything.....

1

There are 1 best solutions below

0
On
RasDialer dialer = new RasDialer();
dialer.EntryName = "the name";
dialer.PhoneNumber = "";
//important,leave this empty,otherwise you will get the exception
RasHandle myras = dialer.Dial();