Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.

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:
C#
using System.Diagnostics; // add this at the top of your code file

C#
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.
 
Share this answer
 
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 !!!
 
Share this answer
 
v3

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900