Run Javascript in C#

Last post 05-08-2008 3:39 AM by rjcox. 1 replies.

Sort Posts:

  • Run Javascript in C#

    05-08-2008, 12:48 AM
    • Loading...
    • das.dwipayan
    • Joined on 03-14-2008, 8:57 AM
    • Hyderabad
    • Posts 11

    Hi all

           I want to run some javascript code embebded in C# .

           I have senario like this:

          I have a xml file which has javascripts codes and that javascript code calls the C# METHODS inside it. 

          I want to embeded the javascript code to C# and run the code.It is  not an ASP.NET application,Completly C# Application (stand alone application).

          Can i go for Microsoft VBS SDK to run the code.

    Thanks Das

     

     

     

        

  • Re: Run Javascript in C#

    05-08-2008, 3:39 AM
    Answer
    • Loading...
    • rjcox
    • Joined on 12-19-2007, 2:14 PM
    • Basingstoke, UK
    • Posts 872

    You should be able to make use of the scripting runtime, but I'm not aware of much documentation for it.

    Essentially you load the scripting runtime, tell it to inject objects into the runtime (so accessible from the script), and then tell it to run the script.

    However the practical details are a lot more complex.

     

    A different approach might be script components (you put the JScript into a specific XML format with a .wsh extension. You can then register this as a COM component and thus access via COM interop. 

    Richard
Page 1 of 1 (2 items)