Click here to Skip to main content
15,896,549 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi How are you?

I have make sample program to create WIFI Hotspot using command prompt (netsh wlan)

But how i can enable or disable internet connection sharing (ICS) for the selected network adapter using C# or VB.net

see the picture for more details
http://s21.postimg.org/iryx292cn/Untitled222.png


Please any help
Thank you in advance
Sorry of my English
Posted
Updated 13-Aug-17 6:30am
v6

Below link may help you

enable or disable internet connection
 
Share this answer
 
These are not directly .net solutions, but consult them:
http://uhurumkate.blogspot.hu/2012/06/internet-connection-sharing-ics-scripts.html[^].
http://msdn.microsoft.com/en-us/library/windows/desktop/aa364722(v=vs.85).aspx[^]
http://superuser.com/questions/470319/how-to-enable-internet-connection-sharing-using-command-line[^]
(here is a sample how to deal with such COM objects in c#: http://blogs.msdn.com/b/securitytools/archive/2009/08/21/automating-windows-firewall-settings-with-c.aspx[^])

[update]
I have just added reference of C:\Windows\System32\hnetcfg.dll library to a project. A NETCONLib namespace is created, and there you have the methods. So I recommend to follow the steps presented in the "pure PowerShell solution" since all those can be one-by-one mapped to c# statements.
 
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