I am using the managed connection manager API from OpenNETCF. Right
now I am trying to connect using the below code, but I am not able to
establish a connection with it. After the Connect( ) call is made
below, a box pops up on the phone saying that it is connecting to the
network, but when the program exits, the network is not actually
connected for some reason.Could anyone please help me here?
Thanks,
ConnectionManager NetCon = new ConnectionManager();
ConnectionDetail NetConDet = null;
foreach (ConnectionDetail cd in
ConnectionManager.ConnectionDetailItems)
{
if ((cd.ConnectionType == ConnectionType.VPN) &&
(cd.ConnectionSubType == ConnectionSubType.PPTP))
{
NetConDet = cd;
break;
}
}
if (NetConDet == null)
throw new Exception("No VPN network configured");
NetCon.Connect(NetConDet.DestinatonNetwork, true,
ConnectionMode.Asynchronous);
while (NetCon.Status != ConnectionStatus.Connected)
{
System.Threading.Thread.Sleep(5000);
}