0

I'm working on c# application which should be licenced, for example:

I get datetime from someone, enter it in my app, and my app is working until that time.

But here I am facing issue:

What about this, if I get for example 31.12.2016 as my expiration date, and that's ok, app works fine, and after while someone change datetime on computer to 1.1.2017 even if it is 7.12.2016 and my app will throw a message "Application expired.".. So that is really bad because customers can affect how long application will work.

Right now I am working with DateTime.Now property which gets a dateTime object that is set to the current date and time on this computer, and that is not good practice in this case. So guys..

Is there any other data about Date and Time which is unchangeable.

Thanks guys, Cheers

Lynn Crumbling
  • 12,985
  • 8
  • 57
  • 95
Roxy'Pro
  • 4,216
  • 9
  • 40
  • 102
  • 1
    You should get the time from internet instead of system. Check out http://stackoverflow.com/questions/6435099/how-to-get-datetime-from-the-internet – vinayvasyani Dec 07 '16 at 14:45
  • Possible duplicate of [How can I make my application have a 30 day trial period](http://stackoverflow.com/questions/3625825/how-can-i-make-my-application-have-a-30-day-trial-period) – Sinatr Dec 07 '16 at 14:46
  • @vinayvasyani, I am talking about offline computer.. – Roxy'Pro Dec 07 '16 at 14:46
  • @Sinatr It is not duplicate, I'm not asking how to make trial or how to licence my application I just wondering is there unique date and time in our computer that I could use for licencing. – Roxy'Pro Dec 07 '16 at 14:48
  • You may want to record the time when your program was executed somewhere in the registry. If your program runs again and finds local time being before this recorded timestamp it can refuse to start. – vinayvasyani Dec 07 '16 at 14:52
  • @vinayvasyani, I allready thought about that, but issue is when user move datetime forward to the expiration date, user will get message: app expired. I would like to prevent that somehow. – Roxy'Pro Dec 07 '16 at 14:56
  • Its exactly what you are doing (expiration date), go through linked questions and actual links in the answers for some hints. The real problem is what you are trying to prevent user from cheating. This it not easy. BIOS clock can be reset, OS reinstalled, registry/file - rewritten, etc. To prevent that specific user action (changing time) simply store current datetime on each software start (using e.g. registry key) and if current date is suddenly smaller than stored one - you know what to do. – Sinatr Dec 07 '16 at 14:58

0 Answers0