How to run exe from ASP.NET 2.0 page on client computer (not on the server)

G

Gen

Hello there,

I will try to be brief on this.
I have a scenario, where I need to do the following things:
1. Save server generated data to a text file on the client computer
2. Start an executable and pass the text file to it as a parameter - again
on the client computer

I managed to solve point 1 by writing a .NET class library, exposing an
Interface to it and using it in the web page similar to an ActiveX object:
<OBJECT id="MyObjectInstance" classid="MyLibrary.dll#MyNamespace.MyObject"
/>
I had some security issues on allowing the object to write to client
computer, but I solved them by configuring the Machine Code Access Security
Policy.


I am still having troubles with point 2 however.

First I tried to upgrade the library by using the System.Diagnostics.Process
class to run the exe. After experimenting with the code for a while I
realized that if a function contained some interaction with
System.Diagnostics.Process it is just not exported in the .dll (or at least
I think so).

Second I tried to use javascript to launch the exe - something like:
function RunExecutableWithParams()
{
var oShell=new ActiveXObject("Shell.Application");
oShell.ShellExecute("C:\\SomeExe.exe","C:\\SomeFile.txt","","open","1");
}
Up to now I haven't managed to get the script to work - the page just
reports errors.
I tried tweeking Security options (particularly "Initialize and script
ActiveX controls not marked as safe"), but it didn't help.


Any kind of help will be appreciated.
Thank you in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top