How to connect/disconnect to remote machine using VPN programmatic

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi all,

I want to kow if there is a way to connet a machine using a VPN client
through vb.net or c# code. I have requirement where i need to copy file using
VPN. Hence, I need to start the connection before copying files and then
disconnect it.

RASdail API is not an option as I am not using modem for internet
connection. Can anyone through some light on it?

Thanks,
maximus
 
Maximus,

Here's what I use through the network (no modem). Hope this helps.

Public Enum VPNSetupType
Connect
Disconnect
End Enum

Public Shared Sub VPNSetup(ByVal SetupType As VPNSetupType)
Select Case SetupType
Case VPNSetupType.Connect
Shell("rasdial mypresetupvpn myusername mypassword",
AppWinStyle.Hide, True, 45000)
Case VPNSetupType.Disconnect
Shell("rasdial mypresetupvpn /DISCONNECT", AppWinStyle.Hide,
True, 45000)
End Select
End Sub
 
Back
Top