protected bool IsAuthorized(string url, string login, string password) { var authorized = false; var thread = new Thread(() => { try { var client = new AdSalesDataControllerService.AdSalesDataControllerService { Url = String.Format("{0}/AdSalesData/quote?ws=1", url) }; var sessionKey = client.getSessionKey(login, password); authorized = !String.IsNullOrEmpty(sessionKey); } catch { } }); thread.Start(); while (thread.IsAlive) Application.DoEvents(); return authorized; }
protected bool IsAuthorized(string url, string login, string password) { var authorized = false; var thread = new Thread(() => { try { var client = new AdSalesDataControllerService.AdSalesDataControllerService { Url = String.Format("{0}/AdSalesData/quote?ws=1", url) }; var sessionKey = client.getSessionKey(login, password); authorized = !String.IsNullOrEmpty(sessionKey); } catch { } }); thread.Start(); while (thread.IsAlive) { Application.DoEvents(); } return(authorized); }