Tech Off Post

Single Post Permalink

View Thread: How to call C#.NET dll from javascript
  • User profile image

    I can think of only two, perhaps three ways.

    1. This will work only with Internet Explorer. Rewrite the Class library to expose itself via COM. Specifically, as an ActiveX. Then, the ActiveX can be setup/registered on EACH client, and you can then use IE's proprietary ActiveXObject - assuming you've marked it safe for scripting.

    2. Rewrite the Class Library so that it is now a plugin to the browser. That's for each browser you want to support. So at a minimum, for IE and Firefox. I doubt you could use .NET for that, so you'll probably need to really rewrite using a different language.

    3. Find or write a generic plugin that allows the browser to consume a .NET library. A lot of work, and you'd probably need to also design (and support, version, etc) an interface between the plugin and the .NET Class Library.

    Now with each of these options, none are trivial to do. The first is probably the easiest, but apart from being limited to IE, you also need to cope with the fact that some client PC's may not have the .NET runtime installed. Strange, but true...

    I suspect you need to back to the drawing board with this one. Such as redoing it using Silverlight 2.0 (which is still in Beta), or whatever the Macromedia one is (Flex ?).