阻止用户在 C# .NET for Windows Forms 中更改其计算机地址的访问
我想要的是:
有一个适用于 Windows XP SP2 和 Windows XP SP2 的 Windows 应用程序(用 .NET 3.5、VS2008、C# 制作)。 SP3
一般用户可以更改IP或修改他们的IP地址。
现在,当我的应用程序启动时,我不希望用户更改 IP 地址,直到我的应用程序停止。
希望现在问题能清楚了。
很快需要您的建议。
仅推荐 C# .NET 或 VB.NET 中的解决方案。
What i want is :
There is one windows app ( made in .NET 3.5, VS2008, C# ) for Windows XP SP2 & SP3
generally users can change there IP or modify their IP Address.
Now,when my apps starts i dont want users to change there IP Address untill my app stops.
Hope now question would be clear.
Need your advice soon.
Recommend solution in C# .NET or VB.NET only.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不,他们不这样做,这是一项非常特权的操作。需要管理员帐户。在 Vista 和 Win7 上,必须确认 UAC 提示。阻止管理员管理机器是注定失败的,而且通常是一种敌对行为。毫无意义的是,管理员拥有杀死您的应用程序所需的所有权力。
解决真正的问题。您可以指望使用管理员帐户运行应用程序的日子已经一去不复返了。任何运行 Vista 或 Win7 的人都会很快卸载你的应用程序。
No they don't, it is a very privileged operation. An administrator account is necessary. On Vista and Win7 the UAC prompt has to be acknowledged. Preventing an admin from administering the machine is a lost cause and in general a hostile act. And pointless, the admin has all the required powers to kill your app.
Fix the real problem. The days that you could count on having your app run with an admin account are long gone. Anybody that runs Vista or Win7 is quickly going to uninstall your app.
我认为您无法采取太多措施来暂时阻止用户更改其 IP 地址。
如果您的应用程序的设计依赖于始终具有相同的 IP 地址,那么它可能是错误的。或者你应该在“要求”中提及。
例如:对于不间断的“操作”,P2P 客户端(如 Bittorrent)依赖于具有相同的 IP 地址,但他们并不强制这样做。
I don't think there is much you can do to temporarily prevent users from changing their IP addresses.
Maybe the design of your application is wrong, if it depends on always having the same IP address. Or you should mention it in the "requirements".
For example: for un-interrupted "action", P2P clients (like Bittorrent) depend on having the same IP address, but they do not enforcing this.
我不认为你可以阻止访问,但你可以监视IP地址,当它发生变化时,你可以使用WMI将其回滚到旧的IP。
I don't think you can block the access, but you can monitor the IP address, and when it changes you can roll it back to the old IP using WMI.