I have just started using the Easy Digital Downloads Software Licensing WordPress Plugin to secure and distribute my .NET applications, as the system was primarily developed for WordPress plugins – I decided I would put together a .NET ‘wrapper’ to make it easier to implement into my projects. You can find the class and usage instructions below.
As always – if you have a suggestion on how to improve this, please leave your comments in the section below
For ease of use, and because I prefer it to the built-in functionality I have used the Json.NET component.
2. Create a new class, insert the following: (Click here for an easy to copy/paste version of the code)
3. Then on your form/where you want to check/activate from:
If you get any unusual responses, make sure you check the URL in a browser – http:///?edd_action=activate_license&item_name=&license=
Replace the message boxes with the code you wish to process depending on the outcome.
It may be worth storing the entered serial number in a user setting, so you can periodically check it’s still valid
Improvements Given the opportunity I plan on doing the following tasks, until then – the module is working..
Replace the first for loop with a direct access of the license value – during testing I was unable to work around an error “Cannot access child value on Newtonsoft.Json.Linq.JValue” until I have resolved this I have chosen to use a select case
Mike Hudson is a Infrastructure Analyst living and working in Kingston Upon Hull. With extensive experience in Microsoft and Apple technologies, ranging from desktop OS’s to Server OS’s and hardware. By day working as part of an infrastructure team, and by night ridding the world of IT issues through blog posts..