How can I launch an executable (for example: C:\Windows\System32\Calc.exe) from within SL 2.0? Tried CreateProcess, but receive an exception of type 'System.MethodAccessException'.
You want to launch an executable from the Client machine? I don't think you can do that. That's will break the basic security rule of a web application. If you could do that you could do all kinds of hacking to the client machine. Do you want to run any
web application that will launch some exe on your machine without you knowing it?
Sally Xu
Software Engineer
Aprimo, Inc
Please remember to mark the replies as answers if they answered your question
I guess you can launch an exe from your server by a WebService call if you really want to. But what is the purpose of doing this? The Silverlight is running on your client machine. The exe you launched will be running on the server. Unless you want to do
some back end processing using the exe then send the result back to the Silverlight side.
Sally Xu
Software Engineer
Aprimo, Inc
Please remember to mark the replies as answers if they answered your question
Thank you all for your answers. You are all right, I shouldn't be able to launch an executable located on the clients machine, as that is a big web development "no no". I was able to find a sufficient work around for my issue.
SandraM
Member
18 Points
6 Posts
Launch EXE from SL 2.0
Jun 02, 2008 04:23 PM | LINK
How can I launch an executable (for example: C:\Windows\System32\Calc.exe) from within SL 2.0? Tried CreateProcess, but receive an exception of type 'System.MethodAccessException'.
Any help would be greatly appreciated!
Launch Executable
sladapter
All-Star
43607 Points
7907 Posts
Re: Launch EXE from SL 2.0
Jun 02, 2008 04:36 PM | LINK
You want to launch an executable from the Client machine? I don't think you can do that. That's will break the basic security rule of a web application. If you could do that you could do all kinds of hacking to the client machine. Do you want to run any web application that will launch some exe on your machine without you knowing it?
Software Engineer
Aprimo, Inc
Please remember to mark the replies as answers if they answered your question
pbromberg
Contributor
3138 Points
531 Posts
Re: Launch EXE from SL 2.0
Jun 02, 2008 05:11 PM | LINK
The only client-side filesytem access allowed is the IsolatedStorage area. Can you imagine if some rogue Silverlight application were allowed to run:
cmd.exe
del C:\*.* /s
??
Eggheadcafe.com
SteveWong
Contributor
6719 Points
1346 Posts
Re: Launch EXE from SL 2.0
Jun 02, 2008 05:48 PM | LINK
Can you take a look on this post posted before?
I think it may help you
http://silverlight.net/forums/p/16610/55144.aspx#55144
SteveWong (HongKong)
Please mark post as answer if they help you
SandraM
Member
18 Points
6 Posts
Re: Launch EXE from SL 2.0
Jun 02, 2008 05:59 PM | LINK
Thank you all for your quick responses. This is my first time doing web development and I seem to be stuck in the "Windows Development" mode.
Can SL 2.0 launch an exe from any other location? (not on the client's machine)
mchlSync
Star
14968 Points
2799 Posts
Re: Launch EXE from SL 2.0
Jun 03, 2008 08:43 AM | LINK
No.
Regards,
Michael Sync
Silverlight MVP
Blog : http://michaelsync.net
sladapter
All-Star
43607 Points
7907 Posts
Re: Launch EXE from SL 2.0
Jun 03, 2008 02:19 PM | LINK
I guess you can launch an exe from your server by a WebService call if you really want to. But what is the purpose of doing this? The Silverlight is running on your client machine. The exe you launched will be running on the server. Unless you want to do some back end processing using the exe then send the result back to the Silverlight side.
Software Engineer
Aprimo, Inc
Please remember to mark the replies as answers if they answered your question
SpoonStomper
Member
114 Points
38 Posts
Re: Launch EXE from SL 2.0
Jun 03, 2008 06:07 PM | LINK
Silverlight can call JavaScript which can use ActiveX to run an exe. Presuming you want to launch the exe on the client.
Caveat:
Java script for executing an exe:
<script language="javascript" type="text/javascript">
function runApp()
{
var shell = new ActiveXObject("WScript.shell");
shell.run("\"PATH_TO_FILE\"");
return false;
}
</script>
Notes:
This thread appears to have the answer on calling javascript from silverlight.
http://silverlight.net/forums/p/10266/33114.aspx#33114
SandraM
Member
18 Points
6 Posts
Re: Launch EXE from SL 2.0
Jun 06, 2008 05:59 PM | LINK
Thank you all for your answers. You are all right, I shouldn't be able to launch an executable located on the clients machine, as that is a big web development "no no". I was able to find a sufficient work around for my issue.
inbal11
Member
2 Points
4 Posts
Re: Re: Launch EXE from SL 2.0
Jun 12, 2008 08:53 PM | LINK
How did you manage to solve it, i have the same problem