public void wbrowser_AuthenticationEvent(object sender, FamilyAuthenticationEvent e) { //MessageBox.Show(((WebBrowser)sender).Url.ToString()); if (printDecode) { trace.TraceInformation("wbrowser_AuthenticationEvent-1:" + e.url + " " + DateTime.Now); } const string tokenHeader = "access_token="; const string expiresInHeader = "expires_in="; string newAuthToken = GetUrlToken(e.url, tokenHeader); if (newAuthToken != null) { //int tokenPos = .IndexOf(tokenHeader); authenticationToken = newAuthToken; string expiryTime = GetUrlToken(e.url, expiresInHeader); if (printDecode) { trace.TraceInformation("wbrowser_AuthenticationEvent-3:" + authenticationToken + " " + DateTime.Now + expiryTime); } if (authenticationWebBrowser != null) { authenticationWebBrowser.Hide(); authenticationWebBrowser = null; } else if (printDecode) { trace.TraceInformation("wbrowser_AuthenticationEvent-4-no auth window !"); } } else if (printDecode) { trace.TraceInformation("wbrowser_AuthenticationEvent-4-no token found!"); } //trace.TraceInformation("WebBrowser_DocumentCompleted-2:" + ((WebBrowser)sender).Url.ToString()); }