public static async Task <string> GetAjaxResult(this WebBrowser wb, string url) { wb.InstallAjaxMethod(); wb.Document.InvokeScript("topAjax", new object[] { url }); await Task.Delay(100); object content = null; while ((content = wb.Document.InvokeScript("getAjaxResult")) == null || content.ToString() == "") { await Task.Delay(100); if (wb.IsBusy) { continue; } } return(content.ToString()); }