This project is read-only.

Event Disconnect

Jul 6, 2009 at 12:31 PM

HI Jeff,

thank you for your previous answer (default gateway), now i should intercept event "Disconnection". I read post about this but i understand how to do.

I'm using rasdial async connection, can you give a sample?

I'm try to watch event "state change" but don't interpect disconnection.



PS: i'm using code as your youtube example.

Jul 6, 2009 at 4:39 PM

Excuse me Jeff,

i resolved using simply :


<font size="2" color="#0000ff"><font size="2" color="#0000ff">


</font></font><font size="2" color="#0000ff">




void rasDialer1_StateChanged(object sender, StateChangedEventArgs e)



<font size="2">




if (e.State == RasConnectionState.Disconnected )

... make somethings


Jul 6, 2009 at 5:23 PM

Re-excuse me,

but how can intercepet disconnection from server? or drop cable?

I'm testing to launch disconnect from vpn server but eventhandler state_change don't intercet vpn client disconnection

Jul 7, 2009 at 2:26 PM

The dialer component dials connections, it has nothing to do with receiving notifications when a connection is disconnected. That state changed event receives notifications for a dial attempt currently in progress only.

Use the RasConnectionWatcher component for that. It will receive notifications for all connections on the machine by default, otherwise if you provide it a handle to monitor (the one returned when your connection was dialed) it will monitor only that specific connection. However, the connected event will still be raised for any connections that connect on the machine.