Hello all!


Okay, I have made a very small stand alone application used basically as a program launcher for a very specific purpose. The application will be run off of a thumb drive, and used several times a day, and on several different machines, for about a month. No internet access will be available.

How can I implement an "end of use" date? I want to be able to use this application until the "end of use" date, and then the application would be unusable after that date.


The "end of use" date will be hard coded. If I need to change the date, I can go back in the code to make the change, and then re-compile the executable.


I only have beginner knowledge of C#, so please take that into consideration.

I appreciate any help that you all can give.

Hendo

What's the purpose of this program? Knowing the use cases can help greatly in figuring out what strategies would work best for locking down functionality.

In the Main() method, put something like this:

if (DateTime.Now >= new DateTime(2011, 8, 20)
    Environment.Exit(0);

This says that, on or after August 8, 2011 it will just terminate the program. Note that this will, of course, be easy to bypass by changing the system time.

What's the purpose of this program? Knowing the use cases can help greatly in figuring out what strategies would work best for locking down functionality.

To launch a few batch files for a situational deployment.

In the Main() method, put something like this:

if (DateTime.Now >= new DateTime(2011, 8, 20)
    Environment.Exit(0);

This says that, on or after August 8, 2011 it will just terminate the program. Note that this will, of course, be easy to bypass by changing the system time.

Heh...that looks so simple. When I put it in, I get red lines all over the place. Is there a "using" statement or something else that I need?

In the Main() method, put something like this:

if (DateTime.Now >= new DateTime(2011, 8, 20)
    Environment.Exit(0);

This says that, on or after August 8, 2011 it will just terminate the program. Note that this will, of course, be easy to bypass by changing the system time.

Actually, that was typo's on my part. This worked great! I really appreciate it!

Hendo

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.