WebBrowser: How to automatically allow activeX content - wpf

I have a problem where I am opening a set of html files found on the local computer which use ActiveX controls.
The constant notification popup is frustrating as every page it appears.
I cannot change the file as it is generated by an external application and I do not want enable ActiveX controls for IE in general.
What I would like to do is allow my webbrowser control, embedded in a WPF window, to allow blocked content automatically if it is from the local computer (or at the very least any blocked content as I can control what my webbrowser control can and cannot open)
I cannot see any obvious way of doing this, there are no options to allow blocked content and no event for identifying when blocked contetn has been foud.
Is there any way to achieve this?
Thanks
EDIT -
There have been plenty of views for this question but not a single comment. I will welcome any suggestions, perhaps even an alternative control, I realise the default WebBrowser is not ideal. Are there any other browsers that do offer this feature?
To add a little detail to the problem I think I should explain the requirements some more:
The resource being displayed is a set of html files that are generated as a report by a legacy tool that cannot be changed.
The tool I have built will allow the user to define the destination for the report and then allow them to browse it using an embedded browser.
I really just need a control that will render html and ActiveX controls as a browser would but without any interference from internet security settings.
UPDATE - Unfortunately I am no longer working on this project, however I am interested in the problem/fix so I shal try and replicate it in my spare time.
I have also renamed the question as I realise the problem I am dealing with specifically is ActiveX content, which may have a solution (see answer from Rajesh) which is specific to this type of content.

You need to add the file location to your trusted sites. This is possible either with a webserver running on your local machine or if the folder where they are located is a shared folder.
In IE, go to Internet Options > Security, select "Trusted Sites" and click the "Sites" button. Enter the location (i.e. file:\server-Hostname\Sharedfolder* for a shared folder) and click "add" (make sure that the "Require server verification (https:)..." option is unchecked).
There is a lot more information available if you search "Add local file to trusted sites" on the web. I do seem to recall adding a local file location without having to share the folder, but at the moment I don't remember how I did it.

Simply add this line to your html page at the start before the html tag.
< saved from url=(0023)http://www.contoso.com/
and then select and comment it.

Related

How to disable password manager for WebBrowser control

The problem is simple, I don't want my embedded browser to display any modal dialogs. User enters the password on the site, that's it. No dialog to "remember this password".
Please DO NOT answer with "use different browser". My question is exactly about System.Windows.Controls.WebBrowser WPF control.
I KNOW that modifying the page HTML on the fly with autocomplete="off" works, but I wonder if there is a Windows Registry hack for that, as it's true for many other super annoying Internet Explorer quirks.
Heres a registry 'hack' for you:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings
Add a new DWORD Value to this directory.
The name needs to be DisablePasswordCachingto and it must be a hexadecimal type.
Insert 1 as value and you should be good to go.
Now you have successfully disabled the password caching in IE (and WPF browser).
If this registry is set, then the standalone IE will not save any passwords too. It's a global option.
Links from where I got the solution:
SO (which is not a good answer so I wrote this one)
Microsoft Support

Gesture support for WPF WebBrowser Control which is displaying a HTML5 Site

In a standard WPF app, I have a WebBrowser control which has been navigated to a HTML5 sample page (http://ie.microsoft.com/testdrive/Browser/BrowserSurface/).
In the browser outside the app, I can interact with this site as expected – move photo’s around, use gestures etc.
In the WebBrowser control the site does not work as expected. It renders, but it does not respond to any touch gestures – It will, however, zoom in and out when I pinch.
Is it possible to make the WebBrowser control pass gesture events etc so that I can interact with the site as I would in a normal browser?
Many thanks for any help with this!
Kris
I know this is an old question but I think this has something to do with the fact that the WebBrowserControl standard uses IE7 ActiveX. I had the same problem which always gave me JavaScript errors in the control for TouchEvents.
After I added some registery key to force the WebBrowserControl to use the latest IE version installed it worked.
Here is what I've add to my registery. Paste it in a txt file and save it as an .reg file. Then DoubleClick it. Or enter the key/value manual in your registery via Regedit.
I even included this in my application code to add the key/value automaticially if it doesn't exist yet.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION]
"RetailTestApplication.exe"=dword:270f
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION]
"RetailTestApplication.exe"=dword:270f
Sorry, the code plugin srews up.
Change IE version for the WPF WebBrowserControl
MSDN Internet Feature Controls (B..C)

Can Silverlight HyperlinkButton forced to open page with Internet Explorer?

Can Silverlight HyperlinkButton forced to open page with Internet Explorer?
If someone has defaulted to one browser (let say Chrome), you cannot ask the current browser (using JavaScript) to open the link to a specific browser (i.e. you want Internet Explorer instead of Chrome). I am not sure about Flash or Silverlight's ability to do what you want.
I have found a technique but it is specific to VBScript inside Excel and it may need the UA agent check to make sure it works correctly for a target environment if you want to adapt the similar code in Silverlight:
http://www.mofeel.net/87-microsoft-public-excel/30085.aspx
With HyperLinkButton you can't. If your OOB app is in full trust mode you can use automation object InternetExplorer.Application to open and control IE.
If you have the right permissions in silverlight you can read and wright to disk. So yes you can.

Changing "active content" security settings on WPF WebBrowser control

I'm putting together a WPF application that will allow users to view PowerPoint files through the WebBrowser control, once the files have been saved as either .MHT or .HTML. The problem is that the files contain ActiveX controls, and the WebBrowser control by default will display a warning every time I load these files, saying "To help protect your security, your web browser has restricted this file from showing active content that could access your computer."
I've seen a few different places online talk about putting the mark of the web into each page, but that really doesn't work for me in this case, since the content authors have control over the files, not the developers, and I'd rather not tell them that they have to open every single file in Notepad and add the mark of the web to each one.
Is there any way to just change the WebBrowser control's settings to not display that warning message? IE has a similar setting, but it doesn't carry over into this control.
We eventually found a decent solution to this, although I still wish there were some sort of settings on the control itself. To load the documents, we just set browser.Source to be the following:
file://127.0.0.1/c$/path/to/the/file (where the path is an absolute path without C:\, for example, c$/Users/jschuster/mydocument.html)
For whatever reason, the control will display files referenced by a URL in that format without a warning.
Hope this might help someone even that the question is a bit old ...
As per the link to "The Mark Of The Web" , adding comment like
<!-- saved from url=(0016)http://localhost -->
just under the HTML tag worked.
My index.html is in HTML folder, added as "content" set to "Always copy" in WPF project using WebBrowser control.
The address to the file during execution look like this:
file:///E:/SRC_2013/WebBrowserTestApp/WebBrowserTestApp/bin/Debug/HTML/index.html
Why not insert the MOTW dynamically at the beginning of the file when you load it ?
By the way, thanks for your question : I didn't know about the "mark of the web" and it solved a problem I had :)
file://127.0.0.1/c$/path/to/the/file (where the path is an absolute path without C:\, for example, c$/Users/jschuster/mydocument.html)
This worked for me as well on Win7.

SWF in WPF WebBrowser control - Auto accept camera/microphone access?

I have an application with a WPF WebBrowser control which displays a Flash file. The flash file is used for WebCam/Microphone chat. At the moment, everytime the flash is loaded it displays a dialog box asking for permission to use the microphone and camera.
How can I fake a click on the allow button to stop hassling users with this question?
Its obviously not possible natively within flash or the WebBrowser, but I think I can send events/messages to the ActiveX object in the WebBrowser control.
You would have to author a full, native ActiveX control. The managed code is going to be sandboxed, and unable to make any P/Invoke calls.
Also, I suspect/wonder if in the case of protected mode IE7/8, if even the trick of using a Full ActiveX control + SendKeys (or the other equivalent of this) would fail.
Note, that at a very basic level, you're trying to circumvent the security policy of flash -- which at the end of the day, is just bad form.
if you have administrator permissions you can share this file on the local machine and then navigate to it, this will ask for the user's permission, I tried that, but this was on internal application and I had full access to all the infrastructure, make sure you navegate using the IP addess , file://127.0.0.1//ShareFolderName/file.swf , and don't use the machine name or the localhost
this should help if you don't have any problem shearing that files

Resources