Changing "active content" security settings on WPF WebBrowser control

Jonathan Schuster picture Jonathan Schuster · Jun 2, 2009 · Viewed 12.5k times · Source

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.

Answer

Jonathan Schuster picture Jonathan Schuster · Jun 5, 2009

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.