views:

193

answers:

2

i am having a intranet asp.net application , all the clients connected to it is having a specific .exe file in their local disk, now i want to execute the .exe file from the .net application hosted in a intranet server. i used this code to do that

Dim psi As New System.Diagnostics.ProcessStartInfo()
psi.WorkingDirectory = "C:\\"
psi.FileName = "file:///c:/Project1.exe" 
psi.Arguments = cTimeMaster.APQPID
psi.UseShellExecute = False
System.Diagnostics.Process.Start(psi)

but it is throwing a error the system cannot find the file specified. is it having a permission issue on local system or any thing else, any help would be greatly appriciated. thanks and regards

+2  A: 

The file is located on the client computer. For security reasons you cannot execute files located on the client computer using ASP.NET.

Darin Dimitrov
ok , is there any alternative for this
sansknwoledge
+2  A: 

Hi sansknwoledge

As Darin and you mentioned, the exe lies on the client. Your VB.NET code in contrast runs on the server. It tries to find the exe file on the c:\ drive of the server.

If you want to access a file on the client you will need to add some client-side code. This induces a lot of security-related and technical constraints - I'm struggling with these right now myself...

For client-side code you could consider MS Silverlight (which allows you to code in VB.NET and do quite many things), or you can embed a VBScript or JavaScript in the HTML page you render, just google for "run exe from javascript" or "run exe from vbscript" and find e.g. http://www.dotnetspider.com/resources/19547-Run-exe-file-Java-Script.aspx (however, this only works in Internet Explorer).

Always keep in mind that ASP.NET is a server-side technology. The VB.NET code is compiled into an assembly which runs on the server. It renders (usually) an HTML page and sends it to the client, then the browser on the client presents that page, so code that should run on the client must be rendered into the HTML page.

chiccodoro
thanks for the information, i might try my hands with silverlight.
sansknwoledge