วันพฤหัสบดีที่ 19 มิถุนายน พ.ศ. 2557

Cannot implicitly convert type 'System.Threading.Tasks.Task' to 'xxx.ApplicationUser'

This happened when I use Microsoft.AspNet.Identity in m WebForm Application with fucntion FindSync
this not will be problem if use this function with await in public async Task<ActionResult>

but for Web Form in "protected void" it will show error like this.

simply to convert task to object is enough then from
ApplicationUser appuser = await manager.FindAsync(uxLogin.UserName, uxLogin.Password);
I use
ApplicationUser appuser = manager.FindAsync(uxLogin.UserName, uxLogin.Password).Result;
to solve this problem

Hope this help.

ไม่มีความคิดเห็น: