networking - What's the best way to programmatically test if a computer is on your corporate (AD) network with C#? -
i writing app needs able tell if host on corporate network.
have come couple of solutions:
- check ip against list of subsets on network
(not great because host @ location same private subnet off corporate network)
- ping internal host dns name
(this method ok, slow - want app keep polling every x mins see if on network)
this should able handle machine being off corporate network , connecting (i.e. connecting on vpn).
is there better way of doing this?
if know name of domain server check logonserver environment variable , see if matches expected domain server name:
var logonserver = environment.getenvironmentvariable("logonserver"); if (logonserver == "myexpecteddomainservername") ...
Comments
Post a Comment