如何启用或禁用Internet连接共享 [英] How to enable or disable internet connection sharing

查看:717
本文介绍了如何启用或禁用Internet连接共享的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


你好吗?



我已经制作了使用命令提示符创建WIFI Hotspot的示例程序(netsh wlan)



但我如何使用C#或VB.net启用或禁用所选网络适配器的互联网连接共享(ICS)



查看图片了解更多详情

http://s21.postimg.org/ iryx292cn / Untitled222.png





请任意帮助

提前谢谢

对不起我的英语

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

推荐答案

以下链接可以帮到你



启用或禁用互联网连接


这些不是直接.net解决方案,但请咨询他们:

http :// UHU rumkate.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 [ ^ ]

(这里有一个如何在c#中处理这样的COM对象的示例: http://blogs.msdn.com/b/securitytools/archive/2009/08/21 /automating-windows-firewall-settings-with-c.aspx [ ^ ])



[update]

我刚刚将 C:\ Windows \System32 \hnetcfg.dll 库的引用添加到项目中。创建了一个NETCONLib命名空间,您可以使用这些方法。所以我建议按照纯PowerShell解决方案中提供的步骤进行操作,因为所有这些步骤都可以逐个映射到c#语句。
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.


这篇关于如何启用或禁用Internet连接共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆