Home All Groups Group Topic Archive Search About

How to connect/disconnect to remote machine using VPN programmatic

Author
10 May 2006 10:13 AM
Maximus
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

Author
10 May 2006 10:03 PM
Mike S.
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

Show quoteHide quote
"Maximus" wrote:

> 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