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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top