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:
Notes
If you get any unusual responses, make sure you check the URL in a browser – http:///?edd_action=activate_license&item_name=&license=
To do
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