Click here to Skip to main content
15,937,602 members
Please Sign up or sign in to vote.
2.00/5 (3 votes)
See more:
I developed (ERP)software in visual C#(2.0).I should give trial version(ERP) to my client(customer) .For example trial period is 10days.
Problems are:
Case 1:
i installed my ERP on 01-jan-2010,10 days trial period. so,it should work untill 20-jan-2010.But Enduser has change system date as
21-jan-2010(actual date is 02-jan-2010).now won't show trial period expired(i set message when trial period completed).
Case 2:
today is date 21-jan-2010,trial period completed,but enduser has change system date change as 10-jan-2010.now its won't work.

my scenario is when installed my software work untill 10day.trial period should not depend system date

**case should work if single pc,no internet connection
Posted
Updated 8-Jul-10 0:04am
v7
Comments
Dalek Dave 7-Jul-10 11:21am    
Edited for readability
William Winner 7-Jul-10 14:29pm    
I realize that English is not your first language, but your question is unclear.

Are you wanting the user to be able to change the system date and have it still work? Or are you wanting it to be based on real time?

It is unclear to me how to help because of the language difference.
DaveyM69 8-Jul-10 18:44pm    
Looking at your edit...
Not possible. There has to be some look up somewhere, either the system DateTime or an independent source such as an NTP server.
If you really think your client(s) are going to rip you off, maybe you should reconsider doing business with them at all.

If you want it to be based on real time, then I would suggest using the internet to test the date and time when you install and when you run.

Because the user can easily change their system clock, that is the only real way that I see you can do it.

You can use the library here: Daytime, Internet Time Service Class[^] and use the DayTime.GetTime() to get the time from the NIST server.

You can use that to set when the license starts and to check whether it has expired. Of course, then an internet connection would be required.

[Update] So you added the requirement that there is no internet connection.

Without an internet connection, you're going to have a real hard time doing this. This is the only way that I can see doing it (but that doesn't mean it is the only way, it's just the only way I know):

When the license is originally created, write an encrypted value to the registry with the current time and date as the start date.

Then, write the same value to another key and call it something like CurrentTimeDate.

Then, whenever the user opens, closes, and periodically throughout the program, update the CurrentDateTime value.

If the system clock is ever less than the value in that key, then disable your program.

They will still be able to fake the clock some if they keep track of when they closed the program and then reset the system clock every time to a few seconds after they closed it last, but that's the best I can think of.
 
Share this answer
 
v2
As has been mentioned previously, you need to store (and encrypt) the DateTime when either installed or first run as desired then check using NTP.

I have two articles dealing with NTP
DateValidator using SNTP[^] and An SNTP Client for C# and VB.NET[^]
 
Share this answer
 
Comments
William Winner 7-Jul-10 15:22pm    
Reason for my vote of 5
more specific to what you're doing
There are several commercial solutions for this. If you learn how to use google, you'll probably find even more.

.Net Licensing Pro[^]

SerialShield SDK[^]

PC Guard[^]

MaxToCode[^]

DeployLX[^]
 
Share this answer
 
One of the ways could be:
You can encrypt and put the date in registry or Application folder of the system. Access the encrypted date of installation from there, decrypt it and check the valid trial version period. :thumbsup:

UPDATE 1:

S.murugesan wrote:
i want only c# code

What i have suggested is a C# way, you can try to implement it. I doubt anyone would give you the whole codebase for that here.
 
Share this answer
 
v2
"If you learn how to use google"


Sarcasm is uncalled for. I have searched "expiry date software", "trial period software", and none of the above vendors show up.

Please tell us what search terms will evince these solutions.
 
Share this answer
 
Comments
Sandeep Mewara 7-Jul-10 12:39pm    
I believe this should be a 'comment' to the answer posted instead of an answer here.
If you post it as a comment, an email will be sent to the person and he will be notified. Otherwise, it's really difficult to know someone posted a comment to an answer.
William Winner 7-Jul-10 14:26pm    
Reason for my vote of 1
not an answer but a comment to another answer.
Use a commercial tool such as CryptoLicensing for this. Focus on your own
software and let such tools take care of the licensing stuff
 
Share this answer
 

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