private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e) { if (_first) { _first = false; } else { string url = null; var exists = false; if (e.Url.Scheme == "applicationdatafile") { var applicationDataFileName = DataCommanderApplication.Instance.FileName; exists = true; url = applicationDataFileName; } else if (e.Url.Scheme == "logfile") { var logFileName = LogFactory.Instance.FileName; if (logFileName != null) { exists = true; url = logFileName; } } else { exists = true; url = e.Url.ToString(); } if (exists) { Process.Start(url); } e.Cancel = true; } }
void WebBrowserForForm_Navigating(object sender, WebBrowserNavigatingEventArgs e) { string blank = "blank"; if (e.Url.AbsolutePath != blank && !IsNotIFrame(sender)) { e.Cancel = true; return; } if (OpenUrlInExternalWindow) { // if this not bookmark // if (!e.Url.AbsoluteUri.StartsWith("#") && !e.Url.AbsoluteUri.StartsWith("about:/#")) { if (e.Url.AbsolutePath != blank) { e.Cancel = true; Runner.OpenURL(e.Url.AbsoluteUri); } } } }
protected override void WebBrowserNavigatingHandler(object sender, WebBrowserNavigatingEventArgs e) { if (null == timer) { this.timer = CreateStartedTimer( () => { DateTime now = DateTime.Now; if (now > this.navigationExpiry) { this.OnUserInteractionRequired(); } }, this.NavigationWaitMiliSecs); } // We don't timeout each individual navigation, only the time between individual navigations. // Reset the expiry time so that it isn't relevant until the next document complete. this.navigationExpiry = DateTime.MaxValue; base.WebBrowserNavigatingHandler(sender, e); }
private void E_DocumentLoading(object sender, WebBrowserNavigatingEventArgs e) { Rhino.RhinoApp.WriteLine(e.Url.ToString()); Rhino.RhinoApp.WriteLine(index); if (e.Url.AbsolutePath != index && IndexLoaded) { e.Cancel = true; var result = ""; var deserializedObject = new TestObject(); Object[] objArray = new Object[1]; if (e.Url.ToString().Contains("sayhi")) { objArray[0] = (Object)"Luis"; result = Wv.Document.InvokeScript("SayHi", objArray).ToString(); deserializedObject = JsonConvert.DeserializeObject <TestObject>(result); } if (e.Url.ToString().Contains("returndata")) { objArray[0] = (Object)1000; result = Wv.Document.InvokeScript("ReturnData", objArray).ToString(); deserializedObject = JsonConvert.DeserializeObject <TestObject>(result); } Rhino.RhinoApp.WriteLine(deserializedObject.ReturnValue); foreach (var num in deserializedObject.Numbers) { Rhino.RhinoApp.Write("{0}{1}", num, ","); } Rhino.RhinoApp.WriteLine(); } }
private void event_Navigating(object sender, WebBrowserNavigatingEventArgs e) { if (_useDefaultWebBrowser) { if (Document.ActiveElement.TagName.Trim().ToLower() == "a") { try { Document.ActiveElement.RemoveFocus(); System.Diagnostics.Process proc; proc = new System.Diagnostics.Process(); proc.StartInfo.FileName = e.Url.ToString(); proc.Start(); proc = null; e.Cancel = true; } catch { } } } }
private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e) { string query = e.Url.Query; #endif if (!string.IsNullOrEmpty(query)) { AuthResultCode result = AuthResultCode.Unknown; string authorizationCode = null; if (OAuthResultParser.ParseQuerystringForCompletedFlags(query, out result, out authorizationCode)) { if (result == AuthResultCode.Success) { this.AuthorizationCode = authorizationCode; } this.ResultCode = result; e.Cancel = true; this._authWaiter.Set(); } } }
// This code executes each time the web browser control is in the process of navigating private void wbAuth_Navigating(object sender, WebBrowserNavigatingEventArgs e) { // Get the url that's being navigated to var url = e.Url.AbsoluteUri; // Check to see if the page it's navigating to isn't the Steam login page or related calls if (url != "https://steamcommunity.com/login/home/?goto=my/profile" && url != "https://store.steampowered.com/login/transfer" && url != "https://store.steampowered.com//login/transfer" && url.StartsWith("javascript:") == false && url.StartsWith("about:") == false) { // start the sanity check timer tmrCheck.Enabled = true; // If it's navigating to a page other than the Steam login page, hide the browser control and resize the form wbAuth.Visible = false; // Scale the form based on the user's DPI settings var graphics = CreateGraphics(); var scaleY = graphics.DpiY * 0.84375; var scaleX = graphics.DpiX * 2.84; Height = Convert.ToInt32(scaleY); Width = Convert.ToInt32(scaleX); } }
protected virtual void WebBrowserNavigatingHandler(object sender, WebBrowserNavigatingEventArgs e) { if (this.webBrowser.IsDisposed) { // we cancel all flows in disposed object and just do nothing, let object to close. // it just for safety. e.Cancel = true; return; } if (key == Keys.Back) { //navigation is being done via back key. This needs to be disabled. key = Keys.None; e.Cancel = true; } // we cancel further processing, if we reached final URL. // Security issue: we prohibit navigation with auth code // if redirect URI is URN, then we prohibit navigation, to prevent random browser popup. e.Cancel = this.CheckForClosingUrl(e.Url); }
private void webBrowserControl_Navigating(object sender, WebBrowserNavigatingEventArgs e) { var webControl = sender as WebBrowser; if (e.Url != null && !e.Url.AbsoluteUri.StartsWith(this.idpEndpoint, StringComparison.InvariantCultureIgnoreCase) && webControl != null && webControl.Document != null) { var form = webControl.Document.Forms["hiddenform"]; if (form != null) { var wa = GetFormAttributeValue(form, "wa", "value"); var wresult = GetFormAttributeValue(form, "wresult", "value"); // Validate wa element if (!FederationSigninWaValue.Equals(wa, StringComparison.InvariantCulture)) { throw new ArgumentException("WS-Federation respons is not a sign-in respons"); } var tokenXml = ReadSamlTokenRequestSecurityTokenResponse(wresult); switch (options.TokenOutput) { case TokenOutput.ReturnTokenString: this.Output = tokenXml; break; case TokenOutput.ReturnRstr: this.Output = wresult; break; default: ReadAndValidateSamlToken(tokenXml); break; } e.Cancel = true; Hide(); } } }
private void webSummary_Navigating(object sender, WebBrowserNavigatingEventArgs e) { if (!summaryLoaded) { return; } e.Cancel = true; if (e.Url.Equals("about:blank")) { return; } if (e.Url.ToString().StartsWith(OPENISSUE_URL_TYPE)) { openIssue(e.Url.ToString().Substring(OPENISSUE_URL_TYPE.Length)); } else { viewUrlInTheBrowser(e.Url.ToString()); } }
void ScrappingBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e) { WebBrowser obj = (WebBrowser)sender; if (Complate) { Initialize(); } Console.WriteLine("NAVIGATING : " + e.Url); StartingCount++; checkcount = 0; if (!this.navigateChecker.Enabled) { this.navigateChecker.Enabled = true; } if (CheckFixcount) { if (FixCount <= StartingCount) { StartingCount = FixCount; } } }
private void InternetExplorerOnNavigating(object sender, WebBrowserNavigatingEventArgs webBrowserNavigatingEventArgs) { Logging(string.Format("Browser::InternetExplorerOnNavigating (Title={0}, AbsoluteUri={1}) - ..." , this.Title , webBrowserNavigatingEventArgs.Url.AbsoluteUri)); if ((webBrowserNavigatingEventArgs.Url.AbsoluteUri.Contains("spongepc.xw.gm.com/CStoneEPC")) && (webBrowserNavigatingEventArgs.Url.AbsoluteUri.Contains("/logout?silent"))) { if (IsDocumentValidate == true) { base.Close(); } else { ; } } else { ; } }
void m_WebBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e) { Console.WriteLine(); Console.WriteLine((DateTime.Now - m_TimeStarted).TotalSeconds.ToString() + " TargetFrameName:" + e.TargetFrameName); string url = e.Url.ToString(); if (url.StartsWith(@"res://ieframe.dll") || url.StartsWith(@"http://www.facebook.com") || url.StartsWith(@"http://platform.twitter.com") || url.StartsWith(@"http://s7.addthis.com") || url.StartsWith(@"https://www.youtube.com") || url.StartsWith(@"https://apis.google.com")) { Console.WriteLine("Skipped: " + url); // e.Cancel = true; } else { Console.WriteLine(url); // e.Cancel = false; } }
private void browser_Navigating(object sender, WebBrowserNavigatingEventArgs e) { try { if (e.Url.ToString().StartsWith("tic://")) { e.Cancel = true; string soub = e.Url.ToString().Replace("tic://", ""); Expand(soub.Remove(soub.Length - 1), menuTree.Nodes); soub = System.Reflection.Assembly.GetEntryAssembly().Location.Replace("Ticketnik.exe", "") + "\\help\\" + soub.Remove(soub.Length - 1); browser.DocumentText = File.ReadAllText(soub).Replace("{verze}", Application.ProductVersion).Replace("{cesta}", System.Reflection.Assembly.GetEntryAssembly().Location.Replace("Ticketnik.exe", "").Replace('\\', '/')); } else if (e.Url.ToString().StartsWith("http")) { e.Cancel = true; System.Diagnostics.Process.Start(e.Url.ToString()); } } catch { MessageBox.Show(form.jazyk.Windows_Help_Nenalezeno); } }
private void InternetExplorerOnNavigating(object sender, WebBrowserNavigatingEventArgs webBrowserNavigatingEventArgs) { try { using (FileStream fileStream = new FileStream("Log.txt", FileMode.Append, FileAccess.Write)) { using (StreamWriter streamWriter = new StreamWriter(fileStream)) { streamWriter.WriteLine(webBrowserNavigatingEventArgs.Url.AbsoluteUri); } } } catch (Exception ex) { using (FileStream fileStream = new FileStream("Log.txt", FileMode.Append, FileAccess.Write)) { using (StreamWriter streamWriter = new StreamWriter(fileStream)) { streamWriter.WriteLine(ex.Message); } } } }
private void helpViewer_Navigating(object sender, WebBrowserNavigatingEventArgs e) { string target = e.Url.ToString(); if (target == "about:blank") { // Allow this } else if (target.Contains(hrefText)) { e.Cancel = true; target = target.Substring(target.IndexOf("/wiki") + "/wiki".Length); if (target.StartsWith("/")) { target = target.Substring(1); } open_wiki(target); } else { e.Cancel = true; } }
private void OnNavigating(object sender, WebBrowserNavigatingEventArgs e) { if (e.Url?.Scheme.StartsWith("http") ?? false) { e.Cancel = true; try { if (Regex.IsMatch(e.Url.AbsoluteUri, @"\b(https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|$!:,.;]*[A-Z0-9+&@#/%=~_|$]", RegexOptions.IgnoreCase)) { #pragma warning disable SCS0001 // Command injection possible in {1} argument passed to '{0}' Process.Start(e.Url.AbsoluteUri); #pragma warning restore SCS0001 // Command injection possible in {1} argument passed to '{0}' } } catch { // Ignore the error because the link is simply not trusted. } } }
private void OnNavigating(object sender, WebBrowserNavigatingEventArgs e) { var url = e.Url?.ToString(); if (string.IsNullOrWhiteSpace(url)) { return; } if (string.Equals("about:blank", url)) { return; } var topic = url.Replace("about:/", string.Empty); if (string.Equals(this.viewModel.CurrentTopic, topic)) { e.Cancel = true; return; } this.messenger.Send(new ShowHelp(topic)); }
void WebBrowserNavigating(object sender, WebBrowserNavigatingEventArgs e) { try { ISchemeExtension extension = GetScheme(e.Url.Scheme); if (extension != null) { extension.InterceptNavigate(this, e); if (e.TargetFrameName.Length == 0) { if (e.Cancel == true) { dummyUrl = e.Url.ToString(); } else if (e.Url.ToString() != "about:blank") { dummyUrl = null; } } } } catch (Exception ex) { MessageService.ShowError(ex); } }
private void webBrowser1_Navigating(Object sender, WebBrowserNavigatingEventArgs e) { if (e.Url != null) { var url = e.Url.ToString(); if (!url.IsNullOrWhiteSpace()) { // 精简版替换为完整版 var asm = AssemblyX.Create(Assembly.GetExecutingAssembly()); url = url.Replace("/archiver/", "/"); if (url.Contains("?")) { url += "&r=XCoder_v" + asm.CompileVersion; } else { url += "?r=XCoder_v" + asm.CompileVersion; } Process.Start(url); e.Cancel = true; } } }
private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e) { // This is the key event. // Here you decide whether to allow navigation to the selected page. // Check the domain. // In this case, only allow the home site. if (!e.Url.Host.Contains("microsoft.com")) { MessageBox.Show("Site restricted for demonstration purposes."); e.Cancel = true; } // Check the page. string page = System.IO.Path.GetFileName(e.Url.LocalPath); if (page.StartsWith("s")) { MessageBox.Show("Page restricted for demonstration purposes."); e.Cancel = true; } }
private void Navigating(object sender, WebBrowserNavigatingEventArgs e) { WebBrowser wb = (WebBrowser)sender; string url = e.Url.ToString(); if (!url.StartsWith("http")) { return; } if (!url.ToLower().Contains("user="******"?")) { url = url + "&user="******"?user=" + this.UserName; } e.Cancel = true; wb.Navigate(url); } }
private void WebBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e) { URL = webBrowser1.Url.ToString(); Status.Text = "Loading..."; if (!webBrowser1.CanGoBack) { button1.Enabled = false; } else { button1.Enabled = true; } if (!webBrowser1.CanGoForward) { button2.Enabled = false; } else { button2.Enabled = true; } }
private void MessageBrowserNavigating(object sender, WebBrowserNavigatingEventArgs e) { if (!_blockExternalNavigation) { var protocolInfo = JanusProtocolInfo.Parse(e.Url.ToString()); var linkType = protocolInfo == null ? LinkType.External : protocolInfo.LinkType; var obManager = _serviceManager.GetRequiredService <IOutboxManager>(); var manager = ApplicationManager.Instance; switch (linkType) { case LinkType.Local: Debug.Assert(protocolInfo != null); if (protocolInfo.ResourceType == JanusProtocolResourceType.Message) { manager.ForumNavigator.SelectMessage(protocolInfo.Id); } else { manager.ForumNavigator.SelectMessage(protocolInfo.Parameters); } break; case LinkType.Absent: Debug.Assert(protocolInfo != null); obManager.AddTopicForDownloadWithConfirm(protocolInfo.Id); e.Cancel = true; break; case LinkType.External: _serviceManager.OpenUrlInBrowser(e.Url.OriginalString); e.Cancel = true; break; } } _blockExternalNavigation = false; }
private void reportWB_Navigating(object sender, WebBrowserNavigatingEventArgs e) { string uri = e.Url.ToString(); if (uri != "about:blank") { e.Cancel = true; if (_diskKey != null && _diskTable != null) { if (_container == null || _container.RootStorage == null) { string filename = ""; if (flashRButton.Checked) { string flashRoot = flashBox.Text.Substring(0, 1); filename = string.Format(@"{0}:\\Государственный пенсионный фонд ПМР\{1}.{2}\edatacon.pfs", flashRoot, _organization.regnumVal, _repYear); } else if (internetRButton.Checked) { filename = Path.Combine(Path.GetTempPath(), Settings.Default.TempFolder); filename = Path.Combine(filename, "edatacon.pfs"); } _container = new CompoundFile(filename); } string html = Storage.GetHTML(_container, uri, _diskKey, _diskTable); _container.Close(); _container = null; if (html == null) { return; } MyPrinter.ShowWebPage(html, true); } } }
/// <summary> /// /// </summary> protected override void OnNavigating( WebBrowserNavigatingEventArgs e) { try { IsLoaded = false; var routing = EventHandled.Default; if (EventSink != null) { routing = EventSink.OnNavigating(this, e); } if (routing != EventHandled.StopRouting) { const string protocol = @"app:"; if (e.Url.ToString().StartsWith( protocol, StringComparison.InvariantCultureIgnoreCase)) { OnAppCommand(e.Url); e.Cancel = true; } base.OnNavigating(e); } } catch (Exception x) { // The web browser control seems to silently eat exceptions, // therefore log at least. // ReSharper disable InvocationIsSkipped LogCentral.Current.LogDebug(x); // ReSharper restore InvocationIsSkipped throw; } }
private async void WebBrowser1_NavigatingAsync(object sender, WebBrowserNavigatingEventArgs e) { progressBar1.Value = 0; if (e.Url.Host.Contains("www.tsdm.me") || e.Url.Host.Contains("forum.php") || e.Url.Host.Contains("www.tsdm.net")) { e.Cancel = true; if (e.Url.ToString() == "http://www.tsdm.me/forum.php?mod=misc&action=pay&mobile=yes&paysubmit=yes&infloat=yes") { await tsdmHelper.PayAsync(tid.Text); progressBar1.Value = 1; webBrowser1.DocumentText = await tsdmHelper.GetThreadAsync(tid.Text, tpage.Text); progressBar1.Value = 2; } else { MatchCollection matchCollection = Regex.Matches(e.Url.ToString(), @"\b\d+\b"); tid.Text = matchCollection[0].ToString(); tpage.Text = matchCollection.Count > 1? matchCollection[1].ToString(): "1"; progressBar1.Value = 1; webBrowser1.DocumentText = await tsdmHelper.GetThreadAsync(tid.Text, tpage.Text); progressBar1.Value = 2; } } else if (e.Url.ToString() == "about:blank") { progressBar1.Value = 2; } else { e.Cancel = true; System.Diagnostics.Process.Start(e.Url.ToString()); progressBar1.Value = 2; } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void WebBrowserNavigatingHandler(object sender, WebBrowserNavigatingEventArgs e) { if (this.webBrowser.IsDisposed) { // we cancel all flows in disposed object and just do nothing, let object to close. // it just for safety. e.Cancel = true; return; } if (key == Keys.Back) { //navigation is being done via back key. This needs to be disabled. key = Keys.None; e.Cancel = true; } // we cancel further processing, if we reached final URL. // Security issue: we prohibit navigation with auth code // if redirect URI is URN, then we prohibit navigation, to prevent random browser popup. e.Cancel = this.CheckForClosingUrl(e.Url); // check if the url scheme is of type browser:// // this means we need to launch external browser if (!e.Cancel && e.Url.Scheme.Equals("browser", StringComparison.CurrentCultureIgnoreCase)) { Process.Start(e.Url.AbsoluteUri.Replace("browser://", "https://")); e.Cancel = true; } if (!e.Cancel) { PlatformPlugin.Logger.Verbose(null, string.Format(CultureInfo.CurrentCulture, " Navigating to '{0}'.", EncodingHelper.UrlDecode(e.Url.ToString()))); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void WebBrowserNavigatingHandler(object sender, WebBrowserNavigatingEventArgs e) { if (webBrowser.IsDisposed) { // we cancel all flows in disposed object and just do nothing, let object to close. // it just for safety. e.Cancel = true; return; } if (key == Keys.Back) { //navigation is being done via back key. This needs to be disabled. key = Keys.None; e.Cancel = true; } // we cancel further processing, if we reached final URL. // Security issue: we prohibit navigation with auth code // if redirect URI is URN, then we prohibit navigation, to prevent random browser popup. e.Cancel = CheckForClosingUrl(sender, e.Url); // check if the url scheme is of type browser:// // this means we need to launch external browser if (!e.Cancel && e.Url.Scheme.Equals(BrowserScheme, StringComparison.OrdinalIgnoreCase)) { // Build the HTTPS URL for launching with an external browser UriBuilder httpsUrlBuilder = new UriBuilder(e.Url) { Scheme = Uri.UriSchemeHttps }; Process.Start(httpsUrlBuilder.Uri.AbsoluteUri); e.Cancel = true; } }
private void BrowserNavigate(WebBrowserNavigatingEventArgs e, bool directInstall, string projectName) { e.Cancel = true; //if (e.Url.AbsolutePath.EndsWith(".zip")) //{ // if (directInstall && UpdateChecker.UpdaterPresent) // { // UpdateChecker.Direct( // "http://213.109.162.193/flrepo/", // projectName, // Assembly.GetExecutingAssembly().Location, // Version.Parse("0.0.0.0"), // Version.Parse(Path.GetFileNameWithoutExtension(e.Url.AbsolutePath)) // ); // Thread.Sleep(1000); // Application.Exit(); // } // else // { // Process.Start(e.Url.ToString()); // } //} }
// Navigating event handle void IEBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e) { // navigation count increases by one navigationCounter++; // write url into the form's caption if (form != null) form.Text = e.Url.ToString(); }
//we have to catch the following three event callers to keep a count //of them so that we will be able to determine when the navigation //process actually completes protected override void OnNavigating(WebBrowserNavigatingEventArgs e) { _onNavigatingCount += 1; base.OnNavigating(e); if (!Busy) OnAbsolutelyComplete(); }