I am trying to send HttpWebRequest under the network that behind the proxy authentication.
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.Proxy = new WebProxy("192.168.0.2", 8080);
req.UserAgent = "Mozilla/5.0";
req.Proxy.Credentials =new NetworkCredential("username","password","DOMAINNAME");
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
StreamReader sr = new StreamReader(resp.GetResponseStream());
Now i want to get the DOMAINNAME of wireless network that i connected to it. So, how can i get the wireless network domain name that specifies with 192.168.0.2 host name ?
Thanks for your advance 🙂
Check out the Win32_NetworkAdapterConfiguration management class, which exposes the
DNSDomainproperty, which is probably what you want. Check out theSystem.Managementnamespace for the classes that access ManagementClass objects.For instance, this snippet will give you a collection of objects, one for each network adapter on the current machine, and print its DNS Domain property.