Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter samfreaks

    (@samfreaks)

    I found out for myself.
    If you find a problem or have suggestions for improvement, write to me.
    If you want, you can include this code in your documentation, because then it will make it easier for other people in my situation.

    Greetings SamFreaks

    Picture of Application in C#

    using System;
    using System.Net.Http;
    using System.Windows.Forms;
    
    namespace Software_License_Manager
    {
        public partial class Login : Form
        {
            public Login()
            {
                InitializeComponent();
            }
    
            private void Login_Click(object sender, EventArgs e)
            {
                var client = new HttpClient();
                const string url = "The License API Query POST URL For Your Installation without / at the end!!!";
                var licenseKey = licenseTxtBox.Text;
                const string licenseVerificationKey = "Secret Key for License Verification Requests";
                var content = @"?slm_action=slm_check&secret_key=" + licenseVerificationKey + "&license_key=" + licenseKey;
    
                var webTask = client.GetStringAsync(url + "/" + content);
                webTask.Wait();
                var response = webTask.Result;
                if (response.IndexOf("\"result\":\"success\"", StringComparison.CurrentCultureIgnoreCase) > 0)
                {
                    //  Here you can decide what should happen if the license is valid
                }
                else if (response.IndexOf("\"result\":\"error\"", StringComparison.CurrentCultureIgnoreCase) > 0)
                {
                    //  Here you can decide what should happen when the license has expired or is not valid!
                }
            }
        }
    }
    • This reply was modified 5 years, 4 months ago by samfreaks. Reason: Edited Image-Link
    Plugin Support mbrsolution

    (@mbrsolution)

    Hi, thank you for sharing your solution. I am sure this will help others.

    Enjoy the plugin.

    Kind regards

    @samfreaks @mbrsolution how do you prevent user from sharing licence keys with others in a Desktop app?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to setup C# License Check and Create?’ is closed to new replies.