webbrowser-control

What can i do about : Enter username and password for “” at http://localhost in Firefox browser?

烈酒焚心 提交于 2019-12-05 06:00:40
问题 Some times when i want to run and debug my asp.net projects and see it on Firefox browser, i see a window that ask me Username and Password for http://localhost IIS. I find this solution and think maybe is useful for others. So decide to share it with you. 回答1: Open firefox and type in the address bar about:config type ntlm in the textbox. Double click on network.automatic-ntlm-auth.trusted-uris and type localhost there. Click on OK. You are done. 回答2: Open firefox and type in the address bar

Is there a way to dynamically create and dispose of Webbrowser control?

血红的双手。 提交于 2019-12-05 05:16:37
问题 I have this App that uses the Webbrowser control to do automated browsing. I need to come up with a way to automatically close the browser (dispose), then create another instance that actually works. Here's some of the code that I have so far. this.webBrowser2 = new System.Windows.Forms.WebBrowser(); this.webBrowser2.Dock = System.Windows.Forms.DockStyle.Bottom; this.webBrowser2.Location = new System.Drawing.Point(0, 34); this.webBrowser2.MinimumSize = new System.Drawing.Size(20, 20); this

Passing a C# class instance back to managed code from JavaScript via COM

对着背影说爱祢 提交于 2019-12-05 05:09:07
The basic outline of my problem is shown in the code below. I'm hosting a WebBrowser control in a form and providing an ObjectForScripting with two methods: GiveMeAGizmo and GiveMeAGizmoUser . Both methods return the respective class instances: [ComVisible] public class Gizmo { public string name { get; set; } } [ComVisible] public class GizmoUser { public void doSomethingWith(object oGizmo) { Gizmo g = (Gizmo) oGizmo; System.Diagnostics.Debug.WriteLine(g.name); } } In JavaScript, I create an instance of both classes, but I need to pass the first instance to a method on the second instance.

WebBrowser control: “Specified cast is not valid.”

不羁的心 提交于 2019-12-05 05:00:06
问题 I used a WebBrowser control to navigate to the login page for a WordPress blog. The page loads fine but whenever I try to access the WebBrowser from a thread. I get a specific cast is not valid exception. Also when debugging, everything freezes up for around 5 seconds. When debugging and I try to access the control. I get timed out errors on all of the member variables. //in constructor of main form Thread.CurrentThread.ApartmentState = ApartmentState.STA; this.CheckForIllegalCrossThreadCalls

WebBrowser Control DocumentCompleted after iframe & Javascript completion

戏子无情 提交于 2019-12-05 04:42:13
问题 I need to capture an image of generated HTML. I'm using Alex Filipovici's excellent solution from here: Convert HTML string to image. It works great except when I'm trying to load a page that has an iframe that uses some Javascript to load. static int width = 1024; static int height = 768; public static void Capture() { var html = @" <!DOCTYPE html> <meta http-equiv='X-UA-Compatible' content='IE=Edge'> <html> <iframe id='forecast_embed' type='text/html' frameborder='0' height='245' width='100

WebBrowser control crashes on Windows 10

对着背影说爱祢 提交于 2019-12-05 04:10:39
问题 The following short code example demonstrates WebBrowser crashing for some pages. The problem started after a fresh installation of Windows 10 and Visual Studio Community 2015 on 26-27 December 2015. The problem did not occur with the previous installation of Windows 10 and Visual Studio Community 2015. The same program has been tested on another computer with the same software and operating system and the same problem occurs. Clicking 'Download 2' successfully downloads the page from Google.

How can I prevent a user from browsing to certain web sites in a WebBrowser control?

╄→尐↘猪︶ㄣ 提交于 2019-12-05 03:22:46
问题 I have a simple web browser embedded in an application that allows a user to search Wikipedia, and I'm trying to prevent the user from browsing to other websites outside wikipedia (e.g. by clicking an external link the references). Right now, I'm using this simple code: this.textBoxAddress.Text = this.webBrowser.Url.ToString(); if (this.webBrowser.Url.Host != "en.wikipedia.org") { this.webBrowser.Visible = false; this.labelErrorMessage.Visible = true; } else { this.webBrowser.Visible = true;

Display PDF from a stream in a WebBrowser control

夙愿已清 提交于 2019-12-05 02:05:58
How can I display a PDF document from a MemoryStream within a WebBrowser control? I've searched around and found I can simply navigate to a PDF file using: webBrowser1.Navigate(@"C:\Temp\ExportedPDF.pdf"); However I want to avoid saving the file anywhere, but I'm currently leaning towards using IsolatedStorage simply because I can't find any other method to get the stream into the browser control. 来源: https://stackoverflow.com/questions/3038043/display-pdf-from-a-stream-in-a-webbrowser-control

WPF rendering problem with HWND children in the way

回眸只為那壹抹淺笑 提交于 2019-12-05 01:24:28
问题 I suppose it is safe to say that WPF renders its contents as a window background. There are no child windows in a traditional HWND sense. So, when one introduces something HWND based in a WPF app, like a WebBrowser, things start to go wrong way it terms of visual appearance. Consider a Window having a Grid with two children, WebBrowser and something else, e.g. TextBox. If WebBrowser were a red circle instead, the TextBox would render on top of it. In case of WebBrowser, no TextBox is to be

Correct way to set ScrollViewer (for vertical scrolling) on a WPF Frame?

房东的猫 提交于 2019-12-05 00:19:45
does anyone know the difference between defining a vertical scrollbar on a frame like this: <ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Auto"> <Frame Name="Frame1" ScrollViewer.CanContentScroll="True" /> </ScrollViewer> or like this: <ScrollViewer Grid.Row="2"> <Frame Name="Frame1" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True" /> </ScrollViewer> This frame is nested in a WebBrowser control and setting it the first way correctly displays the vertical scrollbar and is only visible when it needs to scroll (auto). When I set it the second way the