Access webpage resources from WebBrowser - webbrowser-control

Is there a way or a workaround to access resources loaded by a page in a WebBrowser, either the Windows Forms WebBrowser or the Windows Phone WebBrowser (and/or WPF WebBrowser)?
I've always used the DocumentText property of WebBrowser for web crawling and automated tasks, but never knew if resources are actually accessible from code, just like when we use firebug or the Chrome console to retrieve some documents that have been fetched when loading a page.

Related

VB webbrowser control will not load HTTPS pages

I put together a simple little program for my own personal use in VB2010 that uses an embedded webbrowser control, that allows me to click through pre-selected websites one at a time. It's something I have been using for years with no problem.
Apparently one of the websites which contains a number of pages that I view daily has switched to HTTPS format, and the webbrowser control just says The website cannot display the page. None of the other pages are secure, so I am assuming that this is what's causing the problem. The pages will come up fine on a regular web browser, like IE or Firefox; just not in my embedded web browser.
A Google search for this problem has turned up nothing.
The emulation mode is set to IE11 edge mode through the registry key, but I have also tried setting it for standard IE11, with no change.
What needs to be done to allow secure pages for this simple application?
Thanks!

How to set the nomerge option in .NET WebBrowser control?

I launch IE with the "nomerge" option while testing our web applications, when I need to login as two different users at the same time. I would like to know if the same option is available with the .NET web browser control? (or for that matter with other web browser controls such as geckofx or webkitsharp) I want to launch two web browser controls inside the same winforms test application and be able to login as two different users.

Testing Facebook app on VB.NET WebBrowser - IFrame Access Deined - Cross-Domain Scripting

I have a facebook iframe app I'm trying to test using a WebBrowser Control on a form in VB.NET 2010. Whenever I try to access the WebBrowser.Document.Window.Frames frame object on a document where my app is showing in the broswer, I get an Access Denined exception. Reading around on the web, I see people saying that this is to keep scripts in a document from accessing content in iframes that are pulling content from another domain, as per 'http://msdn.microsoft.com/en-us/library/ms533028.aspx', for security reasons.
While I totally understand why this is done for the general public, how can I disable it on my machine so that I can run these tests? I can't properly test my app without doing it in the facebook iframe and using the WebBrowser control is the only way I know to do this test programmatically.
Any ideas? I'm on windows server 2003 and ie8, .net4.0, if that helps. I own the domain where the app is, and its in AS.NET MVC2, so if there's anything I can do to the web code to enable this??? I also removed the Internet Explorer ENhanced Security COnfiguaration component, but that didn't help.
Thanks,
Philip
Have you tried changing your Internet Explorer settings to enable cross domain scripting?
I believe the VB.Net Web Browser control inherits settings from the local copy of IE.
Try this:
From Internet Explorer, choose Internet Options from the Tools menu.
On the Security tab of the Internet Options dialog box, select the Local Intranet Web Content Zone and then click Custom Level.
Locate the Miscellaneous/Access Data Sources Across Domains setting, and then select Enable, as shown in Figure 2.
Click OK, and then click Yes to the warning dialog box that appears.
Click OK to close the Internet Options dialog box.
Also try adding the Facebook https Url into your trusted sites.
As a last resort disable Native XMLHttp in IE and attempt to revert back to an older version of the XMLHttp object.

System.Windows.Forms.WebBrowser login dialog doesn't appear

When I navigate to an intranet site requiring windows authentication, the WinForms WebBrowser control isn't displaying a login dialog. But it will display (after refreshing the page) if I first open Internet Explorer and view the same page.
Also, if I make the URL refer to my local IIS instance, the login dialog will appear.
Any ideas? Thanks!
You can send credentials via IAuthenticate. You can either extend the winform webbrowser site or write your own webbrowser wrapper.

Hosting multiple WebBrowser controls in one window causes sessions to "cross": any solutions?

I have a Windows forms application written in VB.NET where I host multiple WebBrowser controls in the same window. The problem I'm having is that the session for each WebBrowser control seem to get "crossed" when making asynchronous requests, such as when loading images. For instance, I have WebBrowser1 that loads an HTML document and WebBrowser2 that loads another HTML document. WebBrowser1 hosts an image that's served up by an ASHX page and is dependent on the browser session. The problem is that when the request is made for the image in WebBrowser1, the server actually receives the session ID from WebBrowser2. Is there a way to force each WebBrowser control to have a unique session?
The WebBrowser control is essentially just an embedded version of IE. If you launch the regular IE, log into a website, then launch a second copy of IE and visit the website you'll find yourself already logged in with the second instance because IE shares cookies across instances. The same is true of the WebBrowser control. If fact, if you log into a website with IE and then have the WebBrowser control go there you'll find that its been logged in, too, since the cookies are all shared.
So basically, AFAIK, you can't do what you want.