I am connnecting to an API and using an Async library (Koenzomers) when I run this from a console app, it works absolutely fine, when I run it from a asp.net webform page I can't get it to work.
Code I have
if I try to run the task as I run from the console app
Task TestAuth = TestOtherLibrary();
TestAuth.Wait();
I get the same result.
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Authenticating");
RegisterAsyncTask(new PageAsyncTask(Auth));
}
public async Task Auth()
{
using (KoenZomers.UniFi.Api.Api UnifiApp = new KoenZomers.UniFi.Api.Api(new System.Uri("https://myserverurl"), "unifisiteid"))
{
await UnifiApp.Authenticate("admin", "mysecurepassword");
}
}
The idea is to connect to the unifi controller and authorize user based on mac address
Currently, I get the page loading in a deadlock, not sure if the UI is waiting for the task to end, and it never ends.