Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Asp.Net Programming

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


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.

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc