Quote:
public async Task<ActionResult> RunAsync(string a, string b)
...
restcallController.RunAsync(a,b);
resultop.loginJsonStringop = restcallController.loginJsonString;
An
async
method returns as soon as it hits the first
await
call. The method has not finished until the returned
Task
has completed.
Since you're not waiting for the task to complete, the
loginJsonString
field will not be set.
You need to
await
the returned task before trying to access the
loginJsonString
field.
public async Task<ActionResult> Index(Result resultop)
{
RestCallController restcallController = new RestCallController();
await restcallController.RunAsync(a,b);
resultop.loginJsonStringop = restcallController.loginJsonString;
return View(resultop);
}