Accessing local devices from a Web Application
by Mauricio Rojas, on Nov 26, 2019 10:02:59 AM
Usually when we modernize legacy VB6, Delphi or PowerBuilder apps some parts of the migrated application depend on using a device which is attached to the client using the app.
On a client server app, this is usually not a problem. If you want, for example, to look for a locally attached scanner or printer it is not usually a challenge.
But when you move from your desktop to the web, well, that becomes a little different.
When your application runs inside a browser, it is running inside a Sandbox, and it does not have access to your programs or devices. Which is normally ok. Unless you need to do it :)
In case you need to do that we provide an application template that we call 'DesktopAgent2'. This program is a small .NET app that can be run even on Windows7 computers (if you happen to still have one of those). This program starts a small socket server, to which the browser can connect. Once connected the browser can send small JSON messages that it can use to connect to locally connected devices.
To protect the communication with the browser you can also use WSS and a public-private certificate.
So don't stop here. Go and download the code from https://github.com/orellabac/DesktopAgent2