问题
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.
回答1:
Based on this documentation you should just call the RasHangUp function.
回答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!
来源:https://stackoverflow.com/questions/8841991/how-to-disconnect-from-internet-using-c