Click here to Skip to main content
14,388,907 members
Rate this:
Please Sign up or sign in to vote.
See more:
Is there any easy way to do it with c#.net windows application?
Posted
Comments
PIEBALDconsult 10-Nov-13 11:43am
   
Why? Sounds user-hostile.
Rate this:
Please Sign up or sign in to vote.

Solution 1

To connect, you should run the following command in the Command Prompt: ipconfig /renew
And to disconnect, you should run the following command: iponfig /release
You can do this easily from C# code:
using System.Diagnostics; // add this at the top of your code file

ProcessStartInfo info = new ProcessStartInfo();
info.FileName = "ipconfig";
info.Arguments = "/renew"; // or /release if you want to disconnect
info.WindowStyle = ProcessWindowStyle.Hidden;
Process p = Process.Start(info);
p.WaitForExit();

Hope this helps.
   
Comments
ridoy 10-Nov-13 12:28pm
   
my 5!
Thomas Daniels 10-Nov-13 12:31pm
   
Thank you!
Member 8666669 16-Aug-14 2:05am
   
Can you tell me just like this can we disconnect other system net connection in a network
Thomas Daniels 17-Aug-14 5:30am
   
I don't think you can do that with ipconfig. But if you have access to the configuration page of your router (which is located at 192.168.1.1 or a similar IP), you can block a specific client there.
Member 11885218 8-Apr-16 7:43am
   
Thank you !!!
Rate this:
Please Sign up or sign in to vote.

Solution 2

   
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100