1

Possible Duplicate:
Where and how should I save license related information?

I create a license file for my application in order to distribute to users. But I have no idea where should I store the license file in a user computer.

Any suggestion? thanks

Community
  • 1
  • 1

2 Answers2

3

If the licensing is per user, store it in the %APPDATA% directory. If it is a per computer license, store it in the %PROGRAMDATA% directory or the program's installation directory.

%APPDATA% is a shell variable (you can view them by typing set in a command window) that points the directory where the current user's application data should be stored. It is often something like C:\Users\MyUser\AppData\Roaming. When specifying a path for opening a file, it is possible to use the %APPDATA% variable directly, e.g. %APPDATA%\MyCompany\LicenseFile.dat. As @cdhowie points out in his comment, it is better to use the .NET Environment.GetFolderPath() function than using the environment variables.

%PROGRAMDATA% works the same way, but maps to a directory that is common for all users on the system.

Anders Abel
  • 67,989
  • 17
  • 150
  • 217
1

Storing licenses in form of encrytped registry keys can be another option. For per computer license, store the key in HKLM\Software and for per user license, store the key in HKCU\Software

Deepansh Gupta
  • 593
  • 4
  • 9
  • should I store a license that contains encrypted data into registry key? Do you know how large that Registry key can store data? – Apichart Thanomkiet Aug 07 '11 at 20:10
  • Storing licensing information as encrypted data is the best approach since nobody can make sense of data and hence can't tinker with it. Related to your question on registry key limit's, please refer the following link http://msdn.microsoft.com/en-us/library/ms724872(v=vs.85).aspx – Deepansh Gupta Aug 08 '11 at 03:35