how to get variable in desktop c# program from web

2020-05-06 14:12发布

问题:

I met a problem that there are two applications. one is desktop application in c#, and another is web application in javascript. some variables or informations in running desktop application are needed to transfer to web application. Does any one know how to solve this? Does any one would like to provide more details to solve this?

Regards,

回答1:

I think the processes are very well separated and unless you use a sole handler for c# + js (c#.net to render your page for instance) it is going to be impossible to retrieve data.

Maybe you can get something from the webbrowser object: running it on your page you might gain access to some of your web variables...

Also, if the c# app writes data in a file, the js could read it...

Have fun Rgds



回答2:

When you open the web application, pass the variables in as query string parameters and you can get them using javascript various ways, some of which are noted here