I have the program and I need to restrict it. But I don’t know what way the best. When I run the program I ask for registration key and username. Then take username+somestring+DateTime.Now. Convert it in hash and compare it with key. If true then save in AppData file with username and key. And when run the program do the same. And from this string get date. If DateTime.Now.Day != DateFromString.Day then false. But if user delete this file and change time and then register… He can open it.
What the best way add restriction for one day?
Thanks in advance.
You need to identify in a unique way the machine on which your program has been installed.
Look at the best voted answer in this question.
Encrypt with a secret key the string obtained and send it to a webservice you have control of.
The webservice register in a database the encrypted string with the data of first run.
At the next run of your program send again the same encrypted string to the webservice.
The webservice check strings and date against the database and send back the result.
This is not an absolute fix for your problem and could be fooled.
At least this will require a different machine, a fake webservice or a crack of your code.