Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > running a external program on server side

Reply
Thread Tools

running a external program on server side

 
 
wakun@wakun.com
Guest
Posts: n/a
 
      03-13-2006
Hi there,
I have my webpage written in C# and I am going to run an external
program within the web page. I have my code like

using System;
using System.Diagnostics;

namespace NRP
{
public class RP:System.Web.UI.Page
{
public void tryit()
{
ProcessStartInfo Info = new ProcessStartInfo();

Info.FileName = "A.exe"; // here A.exe will create a new file
on server side
Info.WorkingDirectory = "D:\\temp";
Process Proc ;

try
{
Proc = Process.Start(Info);
}
catch(System.ComponentModel.Win32Exception eee)
{
// error here
return;
}
}
}

I test the code on the local IIS and it works. However, when I put the
code and the DLL on the webserver, it didn't work. I guess it is becase
I didn't set the path of the program properly, but I have no idea how
to set WorkingDirectory properly on server side while I didn't know the
exact path.

 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      03-13-2006
Create a folder in your virtual directory and use it as a working directory.
You can get the physical path with the MapPath method.

Note that it is likely that the problem is not in missing path. You may be
encountering a security problem of the asp.net account not having enough
rights for accessing and running the external application.

Eliyahu

<> wrote in message
news: ups.com...
> Hi there,
> I have my webpage written in C# and I am going to run an external
> program within the web page. I have my code like
>
> using System;
> using System.Diagnostics;
>
> namespace NRP
> {
> public class RP:System.Web.UI.Page
> {
> public void tryit()
> {
> ProcessStartInfo Info = new ProcessStartInfo();
>
> Info.FileName = "A.exe"; // here A.exe will create a new file
> on server side
> Info.WorkingDirectory = "D:\\temp";
> Process Proc ;
>
> try
> {
> Proc = Process.Start(Info);
> }
> catch(System.ComponentModel.Win32Exception eee)
> {
> // error here
> return;
> }
> }
> }
>
> I test the code on the local IIS and it works. However, when I put the
> code and the DLL on the webserver, it didn't work. I guess it is becase
> I didn't set the path of the program properly, but I have no idea how
> to set WorkingDirectory properly on server side while I didn't know the
> exact path.
>



 
Reply With Quote
 
 
 
 
wakun@wakun.com
Guest
Posts: n/a
 
      03-13-2006
Thanks. It works! I try two cases

1) I written a little program in C to create a text file on the server
side. Everything is all right!
2) I try to run another program on server side, it is veeeery slow and
output nothing, no error was outputted. !?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Server-Side Control - Embedded Server-Side Code - Inline Mythran ASP .Net 2 01-22-2005 01:02 AM
client-side browser timeout OR server-side web server timeout?? (please help) jrefactors@hotmail.com Java 0 01-04-2005 04:06 AM
executing an external program in the server side Cédric Rossé ASP .Net 2 09-29-2004 07:19 AM
How can Server-Side variable'value be given to Client-Side variable by program Jack ASP General 3 01-29-2004 01:09 AM
data synchronisation - java server side or www server side? Thor Java 1 07-02-2003 05:44 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57