简体   繁体   中英

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. Users use the web application on a client PC that also has other applications. 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. 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.

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.

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.

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. 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.

3: Save the file using HTML5 local storage and get access to that from a windows service running on the PC.

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)

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? 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

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,

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.

You will need to create one executable for windows and another for 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. whew...

A Java applet with a signed certificate might end up being the best option. With this I can generate files on the client computer once they allow the applet to run.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM