How to interact between a web application and a Windows Form application

I have a problem that a web application is needed (after interacting with the user through Javascript)
1) open the Windows Forms application
2) send the parameter to the application (e.g. ID)

Accordingly, the Windows Forms application should be able to 1) send the parameters back to the web application (updating the URL is ok)
2) open the web application in a new browser if it does not exist. If many browser windows are open, it is important that the correct one is updated.

Windows Forms Application is in ASP.NET
IE6 + Browser
Applications are monitored and executed within a specific organization, so this is not a matter of launching a user application.

Question A) Is this possible?
Question B) How to send parameters to an open Windows Forms application from a web application?
Question C) If you are updating a web application, how can I configure the target browser?

+4
source share
8 answers

What you ask is possible, but it seems uncomfortable.

Trying to call an application from a web page is not something you could do for security reasons. However, you can create a desktop application that will be associated with a specific type of file, and then use the content type on the web page to make sure your application is called when the URL with that type is opened. It will be similar to how MS Office processes .doc or .xls documents or Media Player opens .mp3 or .wmv files.

The second part (opening a specific web page from your application) is easier. Since you need to know the address of your web page, create a URL string with the necessary parameters and open it in the default browser (there are many examples of how to do this, the sample is below).

System.Diagnostics.Process.Start("http://example.com?key=value"); 

If you want to refresh the page in an already opened browser or use the browser of your choice (that is, always IE6 instead of Opera or Chrome), you will have to do your homework, but still pretty easy.

+6
source

The PokeIn library connects your desktop application to your web application in real time / per user. Also, due to its reverse ajax state management, you can treat both of your applications as one.

+2
source

Check out http://msdn.microsoft.com/en-us/library/8c6yea83(VS.85).aspx

Using VBScript on your web page, you can invoke the open Windows Forms application and send keys to it.

This only works in IE, and you need to configure security settings to enable ActiveX.

+1
source

Take a look at the "registered protocols" (for example here and here ). I know that Skype does this to make external phone calls from a web page. But probably some changes will be required in the win application to intercept the parameters from the URL.
I have not tried this, but it should be possible

+1
source

No, I do not think this is possible.
Think of viruses / trojans / spyware. If you could run the application from a simple HTML page, it would be very easy to install malware.
Browsers are designed to prevent this.

0
source

You can use clickonce to deploy and run the forms application - this should take care of sending the parameter to the application.

0
source

While this may not be entirely appropriate for your application, how about using a web service and form?

In addition, you can pass parameters to provide IE6, not Firefox.

 System.Diagnostics.Process.Start("c:\ie6\ie6.exe http://www.example.com/mypage"); 
0
source

Ok, so I found the key to the web part -> winform.

The following code was passed to me from a web application that sends a parameter to a winform application. I assume that this solution has some security factors in the game (for example, allows VBScript (and ActiveX?) To run on a web page. This is normal for me.

Code:

<script type="text/vbscript" language="vbscript">
<!--
Function OpenWinformApp(chSocialSecurityNumber)
Dim oWinformAppWebStart
Set oWinformAppWebStart = CreateObject("WinformAppWebStart.CWinformAppWebStart")
oWinformAppWebStart.OpenPersonForm CStr(chSocialSecurityNumber)
End Function
-->
</script>

0
source

Source: https://habr.com/ru/post/1277104/


All Articles