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:

  1. check ip against list of subsets on network

(not great because host @ location same private subnet off corporate network)

  1. 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

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -