0

I have a RAS connection and I need disconnect to it using C#. How I do this? Currently I'm using dotRas library to handling ras connections.

halfer
  • 19,824
  • 17
  • 99
  • 186
Jack
  • 16,276
  • 55
  • 159
  • 284

2 Answers2

2

Using the DotRas SDK, you'd just need to get the RasConnection instance you want and call HangUp().

using System.Linq;
using DotRas;

RasConnection conn = RasConnection.GetActiveConnections().Where(o => o.EntryName == "My Entry").FirstOrDefault();
if (conn != null)
{
    conn.HangUp();
}

Hope that helps!

Jeff Winn
  • 804
  • 8
  • 14
2

Based on this documentation you should just call the RasHangUp function.

Brad Semrad
  • 1,501
  • 1
  • 11
  • 19