Is is possible to check vpn connection or machine is connected to trusted network? My app need a connection to LDAP to get some data. this action is started when user login to machine and incase user working from outside of a trusted network (home network) and it causes problem when connecting to LDAP.
DirectoryEntry soRoot = new DirectoryEntry("LDAP://mydomain");
string ssDomainContext = soRoot.Properties["distinguishedName"].Value.ToString();
the block of code above will work correctly when machine is connected to VPN successful via Cisco Anyconnect or using office network (trusted network)
My concern is that whether we can detect the connection to VPN or LDAP right after the connection is established and then service will process for next step?
I am thinking about the way that connection will be checked in a loop of each time until the connection is finished but i think this is a wrong way