Kannan,
Are you sure that the security settings allow you to create
ActiveXObjects in javascript? If you are running this from a web page, then
the security settings by default will prohibit the object from being
created.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mvp@spam.guard.caspershouse.com
"Kannan" <pv_kannan@yahoo.com> wrote in message
news:b46a02f.0312150207.5ac7cc61@posting.google.co m...[color=blue]
> Hello,
> I know this has been answered before but I cannot seem to get this
> working for the life of me... Any help/pointers would be greatly
> appreciated.
>
> I am trying to call a set of C# functions from Javascript.... For this
> I created a c# class lib. and put all the functions there. The class
> library itself references other c# assemblies. The library on its own
> works fine...
>
> Here are the steps that I took for this...
>
> 1. Create the class library
> 2. Add functions and declare them as public
> 3. Add references to System.Runtime.InteropServices
> 4. Set the "Register for Com Interop" to true in Project Configuration
> Properties.
> 5. Generate a sname file and add it to assemblyinfo.cs
> 6. Generate unique GUID and declare it before the class declaration.
> 7. Build the solution from VS.NET
> 8. Run regasm from the bin/Release folder to register it. (also tried
> the codebase option)
> 9. Add it to GAC using GACUtil
>
>
> Javascript
> ===========
> 1. Attempt to call the Dll using ActiveXObject function
>
> It gives an error "Microsft Jscript Runtime error: Automation server
> can't create object" on the above line.
>
> Here are some code samples...
>
> c#
> ====
> using ......
> using System.Runtime.InteropServices
> ---- ------
> ---- ------
>
> namespace test
> {
> [GUID("xxxxxxxxxxxxxxxxxxx")]
> class test
> {
> -----
> -----
> }
> }
>
> javascript
> =========
> var obj = new ActiveXObject(test.test);[/color]