Block access for user to change his machine address in C# .NET for Windows Forms
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 modif开发者_StackOverflowy 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.
generally users can change there IP or modify their IP Address.
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.
I don't think there is much you can do to temporarily prevent users from changing their IP addresses.
- On most machines the IP address is controlled by the DHCP server. If this server decides you need to change IP address, you have to follow or your connection is closed.
- Administrators can change the IP address, you could remove a user from the admin group (but that does not prevent point 1). But that should mean you have a controlled user base (in an enterprise), and you should be allowed to do that. (And how are you going to put them back into the admin group if they are not an admin)?
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.
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.
精彩评论