0

I wanted to implement a trial version of my .NET application and I came across solutions that involved saving the dates in the app data folder. The questions I have are related to that solution and I would have commented over there but I dont have enough credits to comment.

So the solution I am following basically saves the created date and last opened date in a folder within App Data folder. If the folder did not exist before hand it creates one and after that checks the validity. That is all very good and it works.

What I want to know is:

1) What if an educated user navigates to the app data folder and deletes the folder. My solution would create a new folder and then it would be like starting over again. What would be the solution to that? I can only think of saving those credentials in different folders and checking all of them. Or maybe create that folder and the credentials during installation (which I dont know how to, I am using InstallSheild Wizard in Visual Studio). So any ideas regarding this?

2) What if originally I gave the client a 30 day trial and I was reading the dates from that folder and then validating. Then sometime later the customer buys a yearly subscription or something. How do cater that change? I could change the validation criteria in the code (I dont think that is very good either) but more importantly how can I sort of reset the app data folder? So that the validation of one year starts from the new installation/update date.

I have very little experience in developing .NET applications and even less in dealing with licenses etc. So kindly let me know a better way if there exists.

Furqan Tariq
  • 73
  • 1
  • 12

2 Answers2

0
  1. You need to hide the file in a secret folder / registry.

  2. You can store subcription info into a file in same folder with the application. Your app will check this file first, if it does not exists, we will check the trail file.

tdat00
  • 810
  • 1
  • 8
  • 11
  • The AppData folder is also a hidden folder. But I was thinking the user may know about it and delete it. Hiding the file in another secret folder runs the risk that if the user unknowingly deletes the containing directory then the program wont work. – Furqan Tariq Nov 23 '15 at 10:58
  • You can put files into %appdata% folder. Most of users nerver known about that folder. Or you'd better write to a registry key. – tdat00 Nov 23 '15 at 10:59
0

The best solution I found was built right into Visual Studio.

Just go into properties of your project and select settings.

Add the fields you want to save. In my case they were the installed and last opened dates. And set the scope to User.

You can now access those fields by Properties.Settings.Default.%propertyname% and do validations and set values as required.

At the end just save the settings.

The settings are saved in the hidden application data folder so they are safe from user intervention.

Furqan Tariq
  • 73
  • 1
  • 12