title: C# Is current network my domain
body: <p>I am building an add-on for office, in which I am to open a browser and navigate to an internal site, which is also exposed through dns, so that it can be accessed from outside the network/domain.</p>
  
  <p>Now, in order to access this site, I need to know whether or not I am inside or outside the domain network. If I'm inside I need to access via internal ip otherwise through the exposed dns address.
  This is where I ask the clever minds of stack overflow, if any of you know of a way to see if the network a computer is currently connected to, is indeed the network of the domain to which the computer/user belongs?</p>
  
  <p>I have been looking at <a href="https://msdn.microsoft.com/en-us/library/system.environment.userdomainname%28v=vs.110%29.aspx" rel="nofollow">Environment.UserDomainName</a> and <a href="https://msdn.microsoft.com/en-us/library/system.directoryservices.activedirectory.domain.getcomputerdomain%28v=vs.110%29.aspx" rel="nofollow">Domain.GetComputerDomain</a>. Both of these could help me find the domain name, in theory (not tested, but expect it to work), but none of them helps me to find whether or not the current network is the domain network.</p>
  
  <p>Any constructive feedback is very much appreciated!</p>
  
  <p><strong>EDIT</strong>
  At some point this add-on is supposed to be sold to various customers, so I can't rely on something as simple as the IP looking in a specific way.
  The solution must be something that can work regardless of the network the computer is connected to.</p>