Hello,
I have a problem of communication between JScript and C#. I must say
that I'm new to both.
In a JS file I have to call a C# function.
In particular I have:
public function Eval(expr : String) : String
{
return eval(expr);
}
And I want to call:
Eval("MyNS.myFunction()");
where myFunction is declared in a C# file, under the namespace MyNS,
and returns a string.
Is it possible to do such a thing without to consider COM objects
(which I've heard to be used in similar problems)?
Note that the .js file is generated dinamically by a CodeDomProvider in
C#.
It is compiled by adding the reference of the .exe file, which contains
myfunction():
parameters.ReferencedAssemblies.Add("MyApp.exe");
So the call Eval("MyNS.myFunction()"); will be done with Reflection
One more question: is there another way to use the jscript function
eval in C#? Maybe compiling a .js module (not dinamically and not using
reflection) that can be used by a C# module?
Thank you.
Alessandro
Brian Williams - 15 Jan 2007 16:59 GMT
You will need to use AJAX, ASP.Net AJAX, or Remote Scripting to call server
methods from client side.
I would use ASP.Net AJAX.
http://ajax.asp.net/ (ASP.Net AJAX)
http://www.codeproject.com/aspnet/AlvaroRemoteScripting.asp
http://developers.sun.com/ajax/index.jsp?cid=59754
Regards,
Brian K. Williams
> Hello,
> I have a problem of communication between JScript and C#. I must say
[quoted text clipped - 31 lines]
>
> Alessandro