system.diagnostics.process in asp.net

D

dave

Hi,

Does anyone know how I could make an .exe launched server
side from an aspx file run faster? When I use javascript
client side it of couse is much faster. Here's my code

This code does work but it's extremely slow. What am I
missing?

Process Updater = new Process();


Updater.StartInfo.FileName = "C:\\Program
Files\\someprogram.exe";
Updater.StartInfo.Arguments = "-somearguments";

Updater.StartInfo.UseShellExecute = true;
Updater.StartInfo.CreateNoWindow = false;
Updater.StartInfo.WindowStyle =
ProcessWindowStyle.Maximized;
Updater.Start();
Updater.WaitForExit();



//Response.Write("<script>var oShell = new ActiveXObject
(\"Shell.Application\"); var commandtoRun =
\"c:\\\\Program Files\\\\someprogram.exe\"; var
commandParms = \"-somearguments";oShell.ShellExecute
(commandtoRun, commandParms,\"\", \"open\", \"1
\");</script>");


//Response.Write("<script>window.close();</script>");
 
N

Nicholas Paldino [.NET/C# MVP]

Dave,

I am assuming that you mean the startup for your exe is slow, and not
the exe itself. What you are doing seems correct. What kind of numbers are
you seeing? Also, since this is in an ASP.NET application, what kind of
load are you seeing on the server? This could be an issue.

I am confused though. You ask how you can make an exe launched server
side from an ASPX file run faster. Then you comment on how when you run it
on the client side it is much faster. Most of the time, the client and the
server are two separate machines, so you are going to see radical changes in
the way it is executed. You can't trigger a process to execute on the
client from the server side, you can only write code that when interpreted
in the browser will execute the executable.

I think that what you are trying to do is get a process to run on the
client side. You will have to use javascript injected into your page to do
this. Also, chances are you will not be able to get it to run, given the
security settings of the machine (imagine if any web page could run any
executable on the client machine that they want. Not good).

Hope this helps.
 
G

Guest

Sorry for the confusion,

Actually I am trying to get the .exe run server side. All
my tests so far have been run on the same machine.


It takes almost 10 times longer using the
system.process.diagnostics then client side javascript.
There is very little load on my machine.


Am I completely missing something?

-----Original Message-----
Dave,

I am assuming that you mean the startup for your exe is slow, and not
the exe itself. What you are doing seems correct. What kind of numbers are
you seeing? Also, since this is in an ASP.NET application, what kind of
load are you seeing on the server? This could be an issue.

I am confused though. You ask how you can make an exe launched server
side from an ASPX file run faster. Then you comment on how when you run it
on the client side it is much faster. Most of the time, the client and the
server are two separate machines, so you are going to see radical changes in
the way it is executed. You can't trigger a process to execute on the
client from the server side, you can only write code that when interpreted
in the browser will execute the executable.

I think that what you are trying to do is get a process to run on the
client side. You will have to use javascript injected into your page to do
this. Also, chances are you will not be able to get it to run, given the
security settings of the machine (imagine if any web page could run any
executable on the client machine that they want. Not good).

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi,

Does anyone know how I could make an .exe launched server
side from an aspx file run faster? When I use javascript
client side it of couse is much faster. Here's my code

This code does work but it's extremely slow. What am I
missing?

Process Updater = new Process();


Updater.StartInfo.FileName = "C:\\Program
Files\\someprogram.exe";
Updater.StartInfo.Arguments = "-somearguments";

Updater.StartInfo.UseShellExecute = true;
Updater.StartInfo.CreateNoWindow = false;
Updater.StartInfo.WindowStyle =
ProcessWindowStyle.Maximized;
Updater.Start();
Updater.WaitForExit();



//Response.Write("<script>var oShell = new ActiveXObject
(\"Shell.Application\"); var commandtoRun =
\"c:\\\\Program Files\\\\someprogram.exe\"; var
commandParms = \"-somearguments";oShell.ShellExecute
(commandtoRun, commandParms,\"\", \"open\", \"1
\");</script>");


//Response.Write("<script>window.close();</script>");


.
 
N

Nicholas Paldino [.NET/C# MVP]

It could be load on the server. Also, when JavaScript does it (which
will not work by the way, the only reason it is working now is that you are
running the browser on the server as well), there is nothing that it does in
order to create an object representation of the process. .NET on the other
hand, does, and it can be costly (some other posts have complained about the
startup time of another process).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Sorry for the confusion,

Actually I am trying to get the .exe run server side. All
my tests so far have been run on the same machine.


It takes almost 10 times longer using the
system.process.diagnostics then client side javascript.
There is very little load on my machine.


Am I completely missing something?

-----Original Message-----
Dave,

I am assuming that you mean the startup for your exe is slow, and not
the exe itself. What you are doing seems correct. What kind of numbers are
you seeing? Also, since this is in an ASP.NET application, what kind of
load are you seeing on the server? This could be an issue.

I am confused though. You ask how you can make an exe launched server
side from an ASPX file run faster. Then you comment on how when you run it
on the client side it is much faster. Most of the time, the client and the
server are two separate machines, so you are going to see radical changes in
the way it is executed. You can't trigger a process to execute on the
client from the server side, you can only write code that when interpreted
in the browser will execute the executable.

I think that what you are trying to do is get a process to run on the
client side. You will have to use javascript injected into your page to do
this. Also, chances are you will not be able to get it to run, given the
security settings of the machine (imagine if any web page could run any
executable on the client machine that they want. Not good).

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi,

Does anyone know how I could make an .exe launched server
side from an aspx file run faster? When I use javascript
client side it of couse is much faster. Here's my code

This code does work but it's extremely slow. What am I
missing?

Process Updater = new Process();


Updater.StartInfo.FileName = "C:\\Program
Files\\someprogram.exe";
Updater.StartInfo.Arguments = "-somearguments";

Updater.StartInfo.UseShellExecute = true;
Updater.StartInfo.CreateNoWindow = false;
Updater.StartInfo.WindowStyle =
ProcessWindowStyle.Maximized;
Updater.Start();
Updater.WaitForExit();



//Response.Write("<script>var oShell = new ActiveXObject
(\"Shell.Application\"); var commandtoRun =
\"c:\\\\Program Files\\\\someprogram.exe\"; var
commandParms = \"-somearguments";oShell.ShellExecute
(commandtoRun, commandParms,\"\", \"open\", \"1
\");</script>");


//Response.Write("<script>window.close();</script>");


.
 

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

Similar Threads


Top