Microsoft 开发人员网络 > 论坛主页 > Visual C# General > How to adjust TCP/IP settings (IP, DNS, etc)
提出问题提出问题
 

已答复How to adjust TCP/IP settings (IP, DNS, etc)

  • 2006年6月9日 15:20mrayyan 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     
    Greetings,
    I am trying to find out how to change the DNS from "Obtain DNS server address automatically" to manual and enter the DNS address.

    Basically, what I want is the following:
    1. If computer ip address subnet is NOT  "141.218.255.255" then change the DNS setting to "Obtain DNS server address autoamtically". 

    2. and if it is "141.218.255.255" then make the DNS primary address "141.218.1.92" and secondary "141.218.218.96"

    Is there away to do this using System.Net?

答案

  • 2006年6月9日 15:41Brendan Grant版主用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     已答复

    Unfortunately this kind of functionality is still not supported by the framework... instead one very easy way to do such things is to pass the necessary arguments to an internally launched instance of netsh.

    When it comes to determining the current networks state however, if you are running the 2.0 Framework I would suggest looking into the NetworkInfromation namespace and all of the gettable properties it provides.

全部回复

  • 2006年6月9日 15:41Brendan Grant版主用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     已答复

    Unfortunately this kind of functionality is still not supported by the framework... instead one very easy way to do such things is to pass the necessary arguments to an internally launched instance of netsh.

    When it comes to determining the current networks state however, if you are running the 2.0 Framework I would suggest looking into the NetworkInfromation namespace and all of the gettable properties it provides.