protected virtual void OnNavigateError(WebBrowserNavigateErrorEventArgs e) { if (NavigateError != null) { this.NavigateError(this, e); } }
/// <summary> /// Notifies the <see cref="P:Parent"/> that an error occured during navigation. /// </summary> /// <param name="webBrowser">The top-level or frame <see cref="T:WebBrowser"/> corresponding to the navigation.</param> /// <param name="url">The URL for which navigation failed.</param> /// <param name="frame">The name of the frame in which to display the resource, or <see langword="null"/> if no named frame was targeted for the resource.</param> /// <param name="status">The <see cref="T:WebBrowserNavigateErrorStatus">error status code</see>, if available.</param> /// <param name="cancel"><see langword="true"/> if the navigation should be canceled; otherwise <see langword="false"/>.</param> /// <returns> /// <see langword="true"/> to cancel the navigation; otherwise <see langword="false"/>. /// </returns> public override bool NavigateError(WebBrowser webBrowser, string url, string frame, WebBrowserNavigateErrorStatus status, bool cancel) { Uri uri = new Uri(url ?? string.Empty); var e = new WebBrowserNavigateErrorEventArgs(webBrowser, uri, frame, status, cancel); this.Parent.OnNavigateError(e); return(e.Cancel); }
private void wbMain_NavigateError(object sender, WebBrowserNavigateErrorEventArgs e) { int code = e.StatusCode; // 发生错误时,转向本地页面 if (code == 404) { wbMain.DocumentText = Config.GetErrorHtml(code); } }
public void NavigateError(object pDisp, ref object url, ref object frame, ref object statusCode, ref bool cancel) { string uriString = (url == null) ? "" : ((string)url); string frameString = (frame == null) ? "" : ((string)frame); int statusCodeInt = (statusCode == null)? 0 : ((int)statusCode); WebBrowserNavigateErrorEventArgs e = new WebBrowserNavigateErrorEventArgs(uriString, frameString, statusCodeInt, pDisp); this.parent.OnNavigateError(e); cancel = e.Cancel; }
/// <summary> /// Nothrow guarantee. /// </summary> void Browser_NavigateError(object sender, WebBrowserNavigateErrorEventArgs e) { Program.AssertOnEventThread(); navigationError = true; try { log.DebugFormat("Navigate error ({0}): {1}", e.StatusCode, e.Url); if ((e.StatusCode == 401 || e.StatusCode == 403)) { log.Warn("Clearing secret and re-prompting, since we've seen a 401/403."); BrowserState.BrowserCredentials creds = lastBrowserState.Credentials; bool persisting = creds == null ? true : creds.PersistCredentials; CompleteClearSecret(lastBrowserState); TriggerGetSecret(lastBrowserState); } } catch (Exception exn) { log.Error(exn, exn); } }
private void wbStatistics_NavigateError(object sender, WebBrowserNavigateErrorEventArgs e) { int code = e.StatusCode; wbStatistics.DocumentText = Config.GetErrorHtml(code); }
private void WebBrowserEx_NavigateError(object sender, WebBrowserNavigateErrorEventArgs e) { Trace.WriteLine(string.Format("URL={0}, TargetFrameName={1}, StatusCode={2}", e.Url, e.TargetFrameName, e.StatusCode), string.Format("[{0}] WebBrowserEx.NavigateError", this.instance)); }
private void wbStatistics_NavigateError(object sender, WebBrowserNavigateErrorEventArgs e) { int code = e.StatusCode; }
private void wb_NavigateError(object sender, WebBrowserNavigateErrorEventArgs e) { }
private void wb2_NavigateError(object sender, WebBrowserNavigateErrorEventArgs e) { this.wb2.Navigate("https://www.google.co.jp/?gws_rd=ssl"); }
// Raises the NavigateError event. protected virtual void OnNavigateError(WebBrowserNavigateErrorEventArgs e) { if (e.StatusCode == 404 && e.Url == string.Format("http://{0}/openid/login/", this.TrackerDomain)) this.Navigate(string.Format("http://{0}/{1}/openid/login/", this.TrackerDomain, this.TrackerSubDomain)); else { MessageBox.Show(this, string.Format(@"Unable to connect to {0}. HTTP Status Code: {1}", e.Url, e.StatusCode), "Navigation Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.ExitThread(); } }
// Raises the NavigateError event. protected virtual void OnNavigateError(WebBrowserNavigateErrorEventArgs e) { if (this.NavigateError != null) { this.NavigateError(this, e); } }
private void wb_NavigateError(object sender, WebBrowserNavigateErrorEventArgs e) { // Display an error message to the user. //Muestro informacion en el laber estado Estado.Text = "Error :" + e.StatusCode.ToString(); /* MessageBox.Show("Cannot navigate to " + e.Url); if (e.StatusCode.ToString() == "404") { MessageBox.Show("Page no found"); } //Lista de errores ¿Creamos IF? //http://msdn.microsoft.com/en-us/library/bb268233.aspx * */ }