Click here to Skip to main content
15,943,008 members
Please Sign up or sign in to vote.
1.22/5 (2 votes)
See more:
Hi,

I need to set Expiry date for my app.
Kindly help me to do so.

Thanx in advance
Posted
Updated 19-Mar-18 1:21am

 
Share this answer
 
In your Main function (See Program.cs) read the expiry date you saved somewhere, and check it against DateTime.Now

What is the problem you are having with that?
 
Share this answer
 
Comments
krishnaspmoorthy 31-May-11 5:40am    
But the user can change the system date... den no use of checking DateTime.Now
Member 10918596 19-Mar-18 7:20am    
As per your requirement, what I see, you cannot check the online server for date. This is quite obvious for offline system.

So, you need to do few things -

set the registration date and expirydate in the form of high encypted data and save it somewhere in registry database.

While the Application opens each time, get the latest clock date and save the encrypted data in registry.

Ensure to check the Clock date and the Last Usage Date. If last usagedate < clockdate, then everything fine but if usagedate>clockdate, user has changed the clock date. So, don't update the registry.

Once the lastusagedate reaches the expiry date, pops a message "Your Trial has been expired.".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900