title: Detect the name of the network the server is connected to
body: <p>When developing an application at home or at work I need to comment the code that sets the <strong>proxy on or off</strong>. Because at home I am on a different network than at work, <strong>at home I don't need to use the proxy</strong>.</p>
  
  <pre><code>WebProxy proxy = new WebProxy(Settings.ProxyAddress, Settings.ProxyPort);
  proxy.Credentials = CredentialCache.DefaultCredentials;
  this.Proxy = proxy;
  </code></pre>
  
  <p>I would like to wrap this statement in a if-clause that determines the name of the network. Like</p>
  
  <pre><code>if(isCorporateNetwork) {.....set proxy...};
  </code></pre>
  
  <p>I tried to detect it with:</p>
  
  <pre><code>IPGlobalProperties.GetIPGlobalProperties().DomainName;
  </code></pre>
  
  <p>But that results as an empty string. Probably because <strong>my personal laptop</strong> is <strong>not a member of the domain</strong>. <em>(However access to the network is granted by sending my credentials to the proxy, own devices are allowed to use the corporate network this way.)</em></p>
  
  <p><strong>How can I detect the name of the network that I am connected to?</strong></p>