I would like to do something with my C# .NET applications that when they are started, they check with a .php site to determin开发者_如何转开发e if the IP address of the machine is in a MySQL database. This would be perfect for me as I have specific machines I want to allow my applications to run on, but I want to prevent the clients from just taking the executable and running it themselves.
What would I need to look into to set something like this up? The part I really have no idea about is the authentication between a .php site and a C# .NET application.
You don't need any authentication.
You just need to send an HttpWebRequest
to your server, have the server check the IP address, and reply Yes
or No
. (You can do this easily by calling WebClient.DownloadString
)
However, your enemies can modify the .Net assembly and remove the check. (This is rather easy to do)
Depending on your situation you may want to consider MAC addresses instead of IP addresses since those are unique to the machine rather than the network (from a functionality standpoint
It would also not be difficult to mimic your server's PHP page by modifying their HOSTS file, but if you don't have too many users or you're not protecting anything extremely valuable this may not be a big concern (as you said in reply to SLaks).
精彩评论