How to disconnect from internet using C#?
Question
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.
Solution
Based on this documentation you should just call the RasHangUp function.
OTHER TIPS
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!
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow