tags:

views:

284

answers:

1

I want to load an html file in a browser locally (not through a web server) that runs some javascript that loads and executes an ActiveX control written in C#. The control may or may not contain .NET forms. Can this be done?

A: 

Yes, as long as you're using a browser that supports ActiveX and it's configured to allow ActiveX to run in the local security zone.

If you open a local XML file with IE, by default you get the message:

To help protect your security, Internet Explorer has restricted this webpage from running scripts or ActiveX controls that could access your computer.

This is an example of a browser running active content as a result of loading a local file.

Have you tried this? Do you get an error?

Eric J.
I get the above message, but the control just shows up as a place holder. Is there a security setting in .NET that may be causing issues?
Phil
There's nothing I'm aware of that should prevent a trivial ActiveX control from displaying. If your ActiveX control is trying to access secured resources, it's doing it within the context of the browser. Can you try a trivial ActiveX control that does nothing but show a simple UI so you know it worked?
Eric J.
I downloaded and tried running a sample from 'http://www.codeproject.com/KB/miscctrl/exposingdotnetcontrols.aspx?msg=152695'. It works under tstcon32, but doesn't show up in the browser at all. They have things locked down pretty tight here, I am going to try it at home later.
Phil
I get around locked down environments by running things in a Virtual PC. If you can set one up, or get the IT folks to do that for you, might make it easier for you to try different security settings.
Eric J.
I'll give that a shot. Thanks!
Phil
Got it to work at home with a couple of changes, but the same code doesn't run here, so I suspect it is a security setting somewhere.
Phil