This project is read-only.

Disconnect VPN

Apr 15, 2009 at 5:52 PM

Thanks for this great solution!

I have a question.

How do i disconnect a VPN connection?

I followed your Youtube Video and my form/code is the same as in the Video.

I added a button to disconnect the VPN connection.

I couldnt find a Disconnect function anywhere.

Apr 15, 2009 at 7:14 PM
Well, you'll need to know either the name of the entry or the handle to the connection you want to disconnect. For ease of use I'm going to use the entry name for this example. It also makes use of the RasDialer component to get access to the connections. This assumes the RasDialer component on your form is named "rasDialer1".

foreach (RasConnection connection in this.rasDialer1.GetActiveConnections())
    if (connection.EntryName == "My Connection")
Apr 16, 2009 at 6:16 PM
Hi Jeff,

Thanks for your reply!

I't works!