简体   繁体   English

无需输入即可将数据从Web应用程序获取到客户端计算机上特定文件夹中的XML文件的方法

[英]Ways to get data from a web application into an XML File in a specific folder on a clients computer without their input

We have a web application that performs certain transactions. 我们有一个执行某些交易的Web应用程序。 Users use the web application on a client PC that also has other applications. 用户在具有其他应用程序的客户端PC上使用Web应用程序。 A second application uses very similar data to the data that is entered into our system. 第二个应用程序使用与输入到我们系统中的数据非常相似的数据。 Currently the user enters it in both system, ours and then the second one. 目前,用户在我们的两个系统中都输入了它,然后在第二个系统中输入了它。

The only way to integrate into the second system is by placing an XML file in a specific folder on the client PC. 集成到第二个系统中的唯一方法是将XML文件放在客户端PC上的特定文件夹中。 I want to be able to generate that XML file and have it saved on the client's computer without the requirement of them having to click or confirm anything. 我希望能够生成该XML文件并将其保存在客户端计算机上,而无需他们单击或确认任何内容。

I know it is not possible to download to a client PC from a browser without their input, but surely there is an easy way if I can install something on their PC. 我知道无法在没有输入的情况下从浏览器下载到客户端PC,但是如果我可以在他们的PC上安装某些东西,那么肯定有一种简便的方法。

So far this is what I've come up with: 到目前为止,这是我想出的:

1: Have the server generate and host the file and have the Download dialog appear so the user can download it. 1:让服务器生成并托管文件,并出现“下载”对话框,以便用户可以下载它。

I don't like this as the user need to confirm the download after every transaction, and also they choose the download directory so there is a chance they will save it to an incorrect location. 我不喜欢这样,因为用户需要在每次交易后确认下载,并且他们选择下载目录,因此有可能将其保存到错误的位置。

2: Create a WCF service on the server that will provide the transaction information and call it from an application on the clients machine. 2:在服务器上创建WCF服务,该服务将提供事务信息并从客户端计算机上的应用程序调用它。 The client application will then generate the file 然后,客户端应用程序将生成文件

This one seems better but it's still not clean. 这似乎更好,但仍然不干净。 First of all the user must remember to run the application and also the username will be required to get the relevant info and this will need to be updated for each user. 首先,用户必须记住要运行该应用程序,并且还需要用户名才能获取相关信息,并且需要为每个用户进行更新。 Users work in shifts so if one comes in and doesn't update the username of the active user then the wrong username will be sent to the web service and no data will be returned. 用户轮班工作,因此如果有人进来并且不更新活动用户的用户名,则错误的用户名将发送到Web服务,并且不会返回任何数据。

3: Save the file using HTML5 local storage and get access to that from a windows service running on the PC. 3:使用HTML5本地存储保存文件,并从PC上运行的Windows服务访问该文件。

I looked into this but it didn't seem feasible. 我调查了一下,但似乎不可行。 Creating a file in the local browser storage does not give you a file on the disk that you can access easily. 在本地浏览器存储中创建文件不会使您可以轻松访问的磁盘上的文件。

4: Using web sockets (eg SignalR) 4:使用Web套接字(例如SignalR)

This one I have only started looking at and don't have a full understanding of so any comments are appreciated. 我只是刚刚开始研究而已,对此还没有完全的了解,请多加赞赏。 Again the username would need to be used to determine which data to send to the client. 同样,需要使用用户名来确定要发送到客户端的数据。

I would like to hear any comments or suggestions on the methods I've explained above or on any other feasible ways to do this. 我想听听对我上面说明的方法或任何其他可行的方法的意见或建议。

It seems like such a simple task but I cannot find a simple answer, maybe point 2 is the way to go? 看来这是一个简单的任务,但我找不到简单的答案,也许第2点是路要走? All comments and suggestions are appreciated 所有意见和建议表示赞赏

No. You are not going to install anything in the client computer or place a file in the filesystem without user consent. 不会。未经用户同意,您不会在客户端计算机上安装任何东西或将文件放置在文件系统中。 It would be a ridiculously huge security hole. 这将是一个荒谬的巨大安全漏洞。

Make the user download a installer that places the file in the right location and that is all. 让用户下载一个将文件放置在正确位置的安装程序,仅此而已。

Create a Custom URL Protocol 创建自定义URL协议

You would install an .exe or .vbs file (or whatever you create) on the client's computer which is invoked when the custom url protocol receives location, 您将在客户端计算机上安装.exe或.vbs文件(或任何您创建的文件),该文件将在自定义网址协议接收位置时调用,

Such as: 如:

 myproto://createfile?data=somedatahere

You can do whatever is needed in your .exe file, such as consume a web service which return the contents of the file. 您可以执行.exe文件中需要执行的所有操作,例如使用返回文件内容的Web服务。

You will need to create one executable for windows and another for mac. 您将需要为Windows创建一个可执行文件,为Mac创建另一个可执行文件。

Once the protocol is in place, you could do some crazy stuff, like setup a websocket which listens for a particular message that fires the custom url protocol which then consumes a web service that returns the contents of the xml file and writes it to the directory on the local files system. 协议到位后,您可以做一些疯狂的事情,例如设置一个websocket来侦听触发自定义url协议的特定消息,然后该消息使用一个Web服务,该服务返回xml文件的内容并将其写入目录在本地文件系统上。 whew... ......

A Java applet with a signed certificate might end up being the best option. 带有签名证书的Java applet可能最终是最佳选择。 With this I can generate files on the client computer once they allow the applet to run. 这样,一旦它们允许applet运行,我就可以在客户端计算机上生成文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将服务器生成的xml文件转储到随机客户端,但是我必须将该文件放在客户端的特定文件夹中 - How to dump an xml file generated from server to a random client, but I have to damp that file in a specific folder of clients 无法将文件从网络下载到计算机上的文件夹中 - Trouble downloading a file from the web to a folder on my computer 从文件夹获取特定文件 - Get a specific file from folder 如何将远程 web 主机上的 php 文件中的数据发送到我计算机上的 c# 应用程序? - how do i send data from a php file on a remote web host to a c# application on my computer? 如何获取应用程序特定的数据文件夹(ProgramData)? - How to get the application specific data folder (ProgramData)? 有什么方法可以从 Web 服务器中托管的 Web 应用程序访问客户端(用户)特殊文件夹 - Is there any way to access clients(users) special folder from web application hosted in web server 从Web应用程序获取DefaultAppPool AppData文件夹 - Get DefaultAppPool AppData folder from the web application 是否可以从Windows 10计算机中的共享文件夹中获取文件? - Is it possible to get a file from a shared folder in a windows 10 computer? 我可以从XML文件中的特定位置获取数据吗? - Can I get data from a specific location in an XML file? 如何在C#表单应用程序中使用xml基于xml文件中的用户输入获取标签的文本 - How to use xml with c# form application To get text for Lables Based on user Input from xml file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM