如何Web App和Windows窗体应用程序之间的交互 [英] How to interact between Web App and Windows Form Application

查看:713
本文介绍了如何Web App和Windows窗体应用程序之间的交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在那里有一个Web应用程序需要(从通过JavaScript用户交互后),以
问题
   1)打开一个Windows窗体应用程序

   2)发送一个参数传递给应用程序(例如ID)

I have a problem where a Web Application needs to (after interaction from the user via Javascript)
   1) open a Windows Forms Application
   2) send a parameter to the app (e.g. an ID)

相应地,Windows窗体应用程序应该能够

   1)参数发送回Web应用程序(更新网址是确定)

   2)在新布劳尔打开Web应用程序,如果它不存在

如果许多浏览器窗口打开,重要的是正确的更新。

Correspondingly, the Windows Forms Application should be able to
   1) send parameters back to the Web Application (updating the URL is ok)
   2) open the Web App in a new brower, if it does not exist
If many browser windows are open it's important that the correct one is updated.

Windows窗体应用程序是ASP.NET

浏览器是IE6 +

该应用程序的控制和内部针对特定的组织,所以它不是推出一个自定义应用程序的问题。

Windows Forms Application is in ASP.NET
Browser is IE6+
The applications are controlled and internal for a specific organisation so it's not a question of launching a custom app.

问题上),这可能吗?

问题B)我如何将参数传递给了开放的Windows从Web应用程序窗体应用程序?

问C)如果更新Web应用程序,我该如何确保正确的浏览器有针对性的?

Question A) Is this possible?
Question B) How do I send parameters to an open Windows Forms Application from a Web App?
Question C) If updating the Web App, how do I make sure the right browser is targeted?

推荐答案

你问什么是可能的,但似乎尴尬。

What you're asking for is possible but seems awkward.

试图拨打从网页应用程序是不是你可以出于安全考虑做。但是你可以做这将有一定类型的文件关联的桌面应用程序,然后使用内容类型的网页上,以确保这种类型的URL打开时,您的应用程序被调用。这将是类似于MS Office处理的.doc或.xls文件或媒体播放器打开名为.mp3或.wmv文件的方式。

Trying to call an application from a web page is not something you could do due to security considerations. You could however make a desktop application which would be associated with a certain type of files and then use content-type on the web page to make sure that your app is called when a URL with this type is opened. It would be similar to the way MS Office handles .doc or .xls documents or the Media Player opens the .mp3 or .wmv files.

第二部分(从你的应用程序中打开特定网页)更容易。
正如你应该知道你的网页的地址来创建一个URL字符串与你想要的参数,并在默认浏览器中打开它(有大量的例子就如何做到这一点,一个样本是下文)。

The second part (opening a particular web page from your application) is easier. As you should know the address of your web page create a URL string with the parameters you want and open it in default browser (there are plenty of examples on how to do that, a sample is below).

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

如果您想更新已经打开浏览器页面或使用您选择的浏览器(即始终IE6,而不是歌剧或Chrome),那么你就必须做一些功课,但它仍然是相当容易的。

If you want to update the page in the already opened browser or use a browser of your choice (i.e. always IE6 instead of Opera or Chrome) then you'll have to do some homework but it's still quite easy.

这篇关于如何Web App和Windows窗体应用程序之间的交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆