0

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,

bird_yin
  • 1
  • 2

2 Answers2

0

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

Community
  • 1
  • 1
Will P.
  • 8,437
  • 3
  • 36
  • 45
  • this c# desktop application is not web application. another platform is web application with javascript. so, it seems that your way can solve two web applications communication. – bird_yin May 16 '12 at 16:02
  • I thought the web application was navigating to the site on the browser in some way, is that not the case? – Will P. May 19 '12 at 03:39
0

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

Sebas
  • 21,192
  • 9
  • 55
  • 109
  • can not solve by file, because this problem needs a better realtime property. – bird_yin May 15 '12 at 18:46
  • i came up with something: there's a new html5 feature: the postmessage() one. If you had a chance to send a message from a virtual c# browser you could retrieve it instantly from your other webapp -managing the proper events. Hey what about this?? Sexy and forward! :-) – Sebas May 15 '12 at 18:52
  • this c# is for desktop program, visual studio. not asp.net c#, how to make a virtual c# browser? – bird_yin May 16 '12 at 16:01
  • thanks. and I am thinking this possibility of using HttpWebRequest to send informations to local web server. Do you know if use this way, how could javascript web application get information by HttpWebRequest from desktop c#? – bird_yin May 16 '12 at 20:42
  • I don't think the app could get it, since the request wouldn't be done from the same client. Only the server could get it, a php page for instance, but then the client apps wouldn't know it unless they themselves request the server, which is not what you want. – Sebas May 16 '12 at 20:52
  • windows c# use HttpWebRequest to send information to web server. and windows c# does not need to know whether it request or not. but web application need to get this information content sent by windows. you mean web application can not get? – bird_yin May 16 '12 at 20:59
  • yes exactly. Once the server gets it, what are you going to do with it? This is the problem, the server receives and answers, only, except if you setup websockets to install a communication between 2 clients (for example, chat clients) – Sebas May 16 '12 at 23:44
  • message queue may solve, I may try. and database. which one could have better real time effect? WCF may solve, but it's complicated than those ways. – bird_yin May 17 '12 at 01:29
  • I think you should open a brand new thread so you have many reactions from experts in this precise domain ;) glad if I helped, rgds. – Sebas May 17 '12 at 01:34