Question

I have a doubt in licensing. I am using C# application. Scenario: User gets the license for the application through mail in the form of file. He/She stores the license file on the Desktop. Later, he/she chooses the license and click register. Now the application is registered (Licensed). After some days, if user deletes the license file from Desktop. The application will stop working since there is no file. I want to store the license details somewhere in registry or file (secret path). But what if that user account doesn't have enough permission to read/write registry or file. Which is the good way? Do you guys know any other method? I am novice in this area. So please help me.

Thanks in advance.

Was it helpful?

Solution

All application data should be stored in the %appdata% directory.

Since you specified C#, here's the code to get the folder:

Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

This will output to the following location: In XP: C:/Documents and Settings/username/Application Data/ In Vista: C:/Users/username/AppData/Roaming

I'd recommend you create a folder in that directory for your application and copy there.

OTHER TIPS

Microsoft has some suggestions for storage locations in the Windows Vista: Application Certification and Compatibility document.

So, if it [your program] is ever changing shared DATA (not CODE) then it [the data] should logically go in to ProgramData folder. If it is individual DATA then it can go to the user profile.

We use a license file and store it in the ProgramData\CompanyName folder. But our licenses are on a per machine basis, not a per user. By default, this folder is hidden in Windows, but is not protected by UAC.

As some one told me some time ago : "The registry is for interaction of the application with the system, not for the interaction of the application with the user." I don't know if this is the right way to see things. I used to store user information in the registry too but not anymore. Putting settings in a file is the better way. If you want to store things like serial numbers don't forget to crypt them.

Absolutely, writing to the registry should probably be avoided in this case, especially if the license can be deleted, added, or altered in the way you seem to be describing. If the licenses is meant to be swapped out or changed in some way after installation, it may be better to write it to a file. Though, I usually don't recommend writing any sort of critical file or data like that to the desktop. I would probably write it to a folder contained within a directory of the application itself. Include it in your application installation if it is that necessary.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top