Gunnarhawk
Gunnarhawk

Reputation: 437

Is it possible to run C# code from the browser that does work on the user's computer

I know the answer is almost certainly no, but I was wondering if you could run code from a server on a user's computer (with their permission).

I have an ASP.NET application running on a remote IIS. What I want the application to do is to be able to access a PCI board on the user's computer and do some work with it. To my knowledge, I cannot do that with just JS running in the browser.

I understand that this would be a huge security vulnerability to the user, but they could Opt-in or Opt-out as necessary.

The other option is to have the application already on the user's computer and ran by the server when necessary, but I just wanted to know if this was even possible.

Upvotes: 2

Views: 996

Answers (1)

Heinz Kessler
Heinz Kessler

Reputation: 1670

It is surprisingly simple, assuming you have access to the user's PC and can install something on his machine (and that's why it's no security issue). You must register a custom URI scheme, which means that you associate a certain program to a protocol taht you specify yourself.

See here

A protocol is something like http. You can create your own protocol like "myxyz" and use URLs like myxyz://blah/blah in your web pages.

Whenever an URL with your protocol is called, the program you associated with the protocol will start. The rest of the URL will be passed to your program as a command line parameter.

Upvotes: 1

Related Questions