473,397 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

running a external program on server side

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.

Mar 13 '06 #1
2 1944
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

<wa***@wakun.com> wrote in message
news:11*********************@v46g2000cwv.googlegro 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.

Mar 13 '06 #2
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. !?

Mar 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: bbxrider | last post by:
for win2k adv server/iis5.0 trying to run an external program from my asp routine that has multiple parameters, see following set shell = server.createobject("wscript.shell") shell.Run...
1
by: Laszlo | last post by:
Hi all, As a novice I installed PostgreSQL 7.2.1 on Win32 and works, Borland C++Builder Enterprise Suite 5.0 (build 12.34) what works too. I decided to combine these two programs and develop a...
2
by: Edward | last post by:
I'm trying to execute an application on the server side in asp.net. For a simple test, I wanted to run notepad.exe which I copied from the windows directory to my web app directory. Here's the...
2
by: Cédric Rossé | last post by:
Hello, I have a web application (asp.net, c#) and I'd like to execute an external program (.exe or .cmd) in the server side (which runs the iis server) when the client press a simple button on ...
16
by: TB | last post by:
Hi all: If you think that the following comments are absolute amateurish, then please bear with me, or simply skip this thread. A couple of months back I made the decision to initiate a...
0
by: LBeveridge | last post by:
Hi, This morning I installed Visual Studio 2005 side-by-side 2003. The first problem I've noted is that projects in 2003 that have "Start External Program" set don't do that. I'm creating a...
4
by: Dylan Parry | last post by:
Hi folks, I'm writing a program that needs to execute an external program and wait for it to finish running before it can make use of the output from that program. Specifically, the external...
0
by: jfigueiras | last post by:
>I have a problem with the module subprocess! As many other programs... I'm not sure what you mean by "non-standard file descriptors". The other program is free to open, read, write, etc any...
9
by: Jimmy | last post by:
Well, i know it may be a little non-python thing, however, I can think of no place better to post this question :) can anyone tell me, in python, how to obtain some information of a running...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.