1

I'm curious what are the pros and cons of the following code to terminate an application from running after a certain date in time.

DateTime expire = new DateTime(2014, 2, 20);

if (DateTime.Now > expire)
            {
                MessageBox.Show("This Software's License has expired!");
                this.Close();
            }

I'm considering using this in a small beta for some software I've written but wonder if its fool proof or can the datetime class be "tampered" with by setting a clock back on the system? I'm not entirely sure if DateTime simply relies on what ever the OS System thinks the time is or not.

PhoenixLament
  • 741
  • 1
  • 11
  • 32
  • possible duplicate of [Create an application that will expire after a trial period](http://stackoverflow.com/questions/1417848/create-an-application-that-will-expire-after-a-trial-period) – John Saunders Feb 06 '14 at 06:18

1 Answers1

3

Yes, DateTime.Now will report current system time, and can be affected by the user changing their clock.

If somebody really wants to continue using your application after their license has expired, it can be pretty easy to crack this kind of technique anyway. But that does not mean that this type of approach has no value to you.

There's already plenty of discussion on SO around this type of idea:

To save you time here's a couple of top tips:

  • If people are willing to crack your app or even just reset their system clock to avoid paying for a license, it's probably not worth your time to try and stop them, and the minimal check in your question is probably all it's worth doing.
  • rather than disabling your app when the license has expired, maybe disable certain features instead, so the app remains as an advert for the full one.
Community
  • 1
  • 1
Ergwun
  • 12,579
  • 7
  • 56
  • 83