/// <summary> /// 引发NavigateError事件. /// </summary> protected virtual void OnNavigateError(WebBrowserNavigateErrorEventArgs e) { if (this.NavigateError != null) { this.NavigateError(this, e); } }
/// <summary> /// Handle the Navigation Error. /// </summary> void wbcSample_NavigateError(object sender, WebBrowserNavigateErrorEventArgs e) { // Navigate to the build-in 404.htm if the http status code is 404. if (chkSuppressNavigationError.Checked && e.StatusCode == 404) { wbcSample.Navigate(string.Format(@"{0}\HTMLPages\404.htm", Environment.CurrentDirectory)); } }
/// <summary> /// 处理链接错误. /// </summary> void wbcSample_NavigateError(object sender, WebBrowserNavigateErrorEventArgs e) { // 如果http状态代码是404,则链接到内建的404.htm页面. if (chkSuppressNavigationError.Checked && e.StatusCode == 404) { wbcSample.Navigate(string.Format(@"{0}\HTMLPages\404.htm", Environment.CurrentDirectory)); } }