Reputation: 2378
Is there a way to capture RAS events such as connection and disconnection. I need to do it on my application but it does not control the dialing process or disconnection, that's why "capture" part. My goal is to receive notification of when a connection and disconnection event happens, I've tried by listening system events but maybe i need to change something on group policy to audit RAS events or some....
PS: i would like also to capture ras dial in interface events (remote access server events) (client connection and disconnection)
Upvotes: 0
Views: 1127
Reputation: 804
There is a component as part of the DotRas SDK which handles event based notifications from Windows upon connection and disconnection of RAS connections. Keep in mind that the events may not be immediate, it depends entirely upon when Windows notifies the component that the connection has connected or disconnected.
using DotRas;
RasConnectionWatcher watcher = new RasConnectionWatcher();
watcher.Connected += (sender, e) => { // Do something useful. };
watcher.Disconnected += (sender, e) => { // Do something useful. };
watcher.EnableRaisingEvents = true;
For a download link to the above mentioned SDK, see the official website at: http://dotras.codeplex.com
Hope that helps!
Upvotes: 0