views:

805

answers:

2

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.

A: 

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 :)

Thomas Levesque
Mostly because it adds a lot more work to our end, especially finding the end of the DOCTYPE declaration. I'm probably imagining it to be more work than it is, but right now we're just setting browser.Source to essentially a modified file path, so actually loading and parsing the file adds a bit more effort.Plus, it just seems like the WebBrowser control should have some sort of settings for this, in case the default security settings don't meet your needs.
Jonathan Schuster
+2  A: 

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.

Jonathan Schuster
Wow... I love the so-called security of Internet Explorer, it's so easily tricked ;)
Thomas Levesque
Neither of these workarounds seem to work for me. Maybe it's windows 7 :(
SteveCav