Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5969555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:14:50+00:00 2026-05-22T20:14:50+00:00

I need to remotely load a .NET DLL that contains an ActiveX object (non-visual)

  • 0

I need to remotely load a .NET DLL that contains an ActiveX object (non-visual) and then access it via javascript using the new ActiveXObject() method.

Currently IE8 is correctly loading this DLL with the path from the codebase attribute on the object tag, but the ActiveXObject is failing due the ActiveX bootstrapper not finding the DLL in the registry.

I am using ProcMon to track the events that are occurring, and can verify that the DLL is being downloaded, and that the registry is being probed by the new ActiveXObject method. this second part is failing though since the ActiveX object is not in the registry..

<body>
    <object
        name="Hello World"
        classid="clsid:E86A9038-368D-4e8f-B389-FDEF38935B2F"
        codebase="http://localhost/bin/Debug/Test.ActiveX.dll">
    </object>  

    <script type="text/javascript">    
        var hw = new ActiveXObject("Test.ActiveX.HelloWorld");
        alert(hw.greeting());
    </script>    
</body>

If I use regasm I can provide the necessary registrations and then it all works, however I don’t want to deploy an installer for this purpose – I understand that IE should register the DLL for me – I just don’t know what mechanism does this.

The .NET class has the necessary attributes to make this all work within regasm, but it seems that the registry code is not being invoked. (Registration code was poached from here)

namespace Test
{
    [Guid("E86A9038-368D-4e8f-B389-FDEF38935B2F")]
    [InterfaceType(ComInterfaceType.InterfaceIsDual)]
    [ComVisible(true)]
    public interface IHelloWorld
    {
        [DispId(0)]
        string Greeting();
    }

    [ComVisible(true)]
    [ProgId("Test.ActiveX.HelloWorld")]
    [ClassInterface(ClassInterfaceType.None)]
    [ComDefaultInterface(typeof(IHelloWorld))]
    public class HelloWorld : IHelloWorld    
    {
        [ComRegisterFunction()]
        public static void RegisterClass(string key)
        {
            // Strip off HKEY_CLASSES_ROOT\ from the passed key as I don't need it
            StringBuilder sb = new StringBuilder(key);
            sb.Replace(@"HKEY_CLASSES_ROOT\ ", ""); // <-- extra space to preserve prettify only.. not in the real code

            // Open the CLSID\{guid} key for write access
            using (RegistryKey k = Registry.ClassesRoot.OpenSubKey(sb.ToString(), true))
            {
                // And create the 'Control' key - this allows it to show up in 
                // the ActiveX control container 
                using (RegistryKey ctrl = k.CreateSubKey("Control"))
                {
                    ctrl.Close();
                }

                // Next create the CodeBase entry - needed if not string named and GACced.
                using (RegistryKey inprocServer32 = k.OpenSubKey("InprocServer32", true))
                {
                    inprocServer32.SetValue("CodeBase", Assembly.GetExecutingAssembly().CodeBase);
                    inprocServer32.Close();
                }

                // Finally close the main key
                k.Close();
            }
        }

        ...

        public string Greeting()
        {
            return "Hello World from ActiveX";
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:14:51+00:00Added an answer on May 22, 2026 at 8:14 pm

    The simple answer to this question is that you can’t; IE will not load an activex control that it does not know about.

    What you can do is find a way to install the DLL (and thus register the ActiveX control) and then load it after it has been installed. Natively, this isn’t possible to do “automatically” without any prompt from the user, probably because that would be a nightmareish security hole.

    Now, if you’re just looking for the “native” install method for ActiveX control, that would be a CAB file that you specify. It won’t do everything for you “automatically”, but it can be used to have IE prompt the user to install the ActiveX control, which will cause your installer to run.

    You can find information on how to use this method at http://msdn.microsoft.com/en-us/library/aa751974(v=vs.85).aspx

    Doing what you’re trying to do in C# is probably not a very flexible method; it will only work if the user has .net installed, and I have never tried using a CAB file to install a .net ActiveX control. I would recommend that you consider using a regular browser plugin or C++ ActiveX control. You could look at FireBreath for creating something in C++ that would work as an ActiveX control but also on all other browsers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need a function that takes a character as a parameter and returns true if
Need to an expression that returns only things with an I followed by either
Need to locate the following pattern: The letter I followed by a space then
need ask you about some help. I have web app running in Net 2.0.
Need a function like: function isGoogleURL(url) { ... } that returns true iff URL
I've got a configuration xml file that I need to parse for values before
I need to remotely profile a JVM for CPU Usage, IO stats and File
I am trying to load a html page through UIWebview.I need to disable all
i have a input tag which is non editable, but some times i need
Need a way to allow sorting except for last item with in a list.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.