'how to call web api when are windows application installing time?

I have developed windows application, and when the user tries to install at that time, call a web api and check if the user is an activated or registered user. again returned value wise install our windows application other wise rollback.

How can I do this functionality?

I already tried to follow this function in the installer class but it did not call the web api.

HttpResponseMessage response = await client.PostAsJsonAsync("Search/Verifysystemreg", new IdentityHelper { IdentityKey = IdentityKey, Systemname = Systemname });



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source