Restrict the installation of .net application to limited times

S

sudhaoncyberworld

Hi Techies,

I have created Setup & Deployment project and installing a windows
application from that. Now i want to restrict the user to install my
application only upto 3 times.

After that it should prompt to the user to download again from the
site.

Can anyone guide me in this.

Will registry editor be useful for this..,

Expecting some quick solution

Thanx
 
I

idletask

Yes, the registry is an option. I prefer to keep configuration in my
app directory. If you are looking for something other than the
registry and don't want to call a web service or other type of internet
check to test installation count- you can use a file and store it
someplace that it wont be removed from if the software is uninstalled.

There are all kinds of ways you can structure the file- here is just
one idea:

1) create an XML object that writes XML that looks something like this:

.... psuedo xml:

<xml>
<installs maxInstalls="3">
<installDate appVersion="{your app's version
number}">{date}</installDate>
</installs>
</xml>

- when your app runs, it can look for this file in whatever place you
choose to store it (outside the application directory so that if the
user uninstalls the file is still there. maybe the user's temp folder
or someplace you can normally read and write to).

If found, it looks for the number of install attempts and either adds
another childnode to the list (i noted only 1 install in my example) if
not, it creates it and populates it with the first install date and
version number. If the count is greater than what you specify, you
prompt the user for further action.

I would also encrypt the file to make it non-readable to people. There
are numerous easy encryption classes available.

The flaw in this is that if the user figures this out, they can delete
the file and be good to go so I fully agree that this is "security via
obscurity" - but you did ask for something quick...

You can write encrypted strings to the registry too of course, but you
can run into permission issues with the registry depending on the
user's environment so I shy away from this.

Your file does not have to be XML, but XML is easy and convenient for
this purpose.
 
S

sudhaoncyberworld

Thanks for your detailed information. I preferred way of Registry
editor and i got the solution
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top