Old Dos Program from asp.net website

W

wmotter

I have a requirement to execute a legacy DOS program from within an
ASP.NET Website. I have it working in my sandbox machine but when I
put it live and select the option via asp:button the site simply
refreshes and no new window with said DOS application appears. The
application is present in the task list on the server. The
environement is windows 2003 with IIS 6.0. I have checked the 'Allow
serviec to interact with desktop' check box in the IIS Admin services
and have modified the machine.config process model tag to
<processModel userName="SYSTEM" password="AutoGenerate" /> as per the
msdn article 'Unable to Start a Process from ASP.NET' (not sure that
is exactly what I should put). I have tried to modify the IIS_WPG
group to allow system privileges and even assigned it adminstrator
rights for a bit to see if that did anything. I have also played
around with the ASPNET account in IIS and gave in admin privileges to
see if that does anything. I added the process code that starts the
app below but since I see it in the task list I assume that is good.
I can't think of anything else I can do any help would be appreciated.

System.Diagnostics.Process cmd = new System.Diagnostics.Process();
cmd.StartInfo.FileName = "cmd.exe";
cmd.StartInfo.RedirectStandardInput = true;
cmd.StartInfo.RedirectStandardOutput = true;
cmd.StartInfo.CreateNoWindow = true;
cmd.StartInfo.UseShellExecute = false;
bool started = cmd.Start();
if (started)
{
Button btn = (Button)sender;
string arg1 = btn.CommandArgument.ToString();
cmd.StandardInput.WriteLine(@"D:\wincmd\TotalCmd.exe",
arg1);
cmd.StandardInput.Flush();
cmd.StandardInput.Close();
}
 
M

Mark Rae [MVP]

I have a requirement to execute a legacy DOS program from within an
ASP.NET Website. I have it working in my sandbox machine

What are you actually expecting to happen here...?

Presumably, your sandbox machine is the one at which you're sitting while
you're developing...?
System.Diagnostics.Process cmd = new System.Diagnostics.Process();

Which will try to run on the webserver, not a client machine...
 
W

wmotter

What are you actually expecting to happen here...?

Presumably, your sandbox machine is the one at which you're sitting while
you're developing...?


Which will try to run on the webserver, not a client machine...

Thanks for the response. I am running my website local (localhost on
the 'sandbox' machine) using IIS 5.0 and what happens is a second
window pops with the dos application executing when I select a button
on the asp.net website. You have raised an issue I am unsure about
and that is running a DOS app from an asp.net web site. Can I execute
a dos app on the web server from an asp.net website so that an
individual can view/use it from their client machine. I would think
there might be something inherently prohibited about this from a
security standpoint but maybe that is why I need to jump through all
of these permission hoops. BTW, I log on as sys admin to the web
server that is running the live site in question and try to execute
this scenario to no avail. This server is an internal server not
accessible outside of the office.
 
M

Mark Rae [MVP]

Thanks for the response. I am running my website local (localhost on
the 'sandbox' machine)

That's what I thought...
Can I execute a dos app on the web server from an asp.net website...

Yes.

....so that an individual can view/use it from their client machine.

No.
I would think there might be something inherently prohibited about this
from a security standpoint but maybe that is why I need to jump through
all
of these permission hoops.

It's nothing to do with security - it's simply that ASP.NET is running on
the server, and that's where any processes which ASP.NET initiates will
run...
BTW, I log on as sys admin to the web server that is running the live site
in
question and try to execute this scenario to no avail.

That won't make any difference.
This server is an internal server not accessible outside of the office.

Irrelevant...

What does this DOS app do? Why does someone need to watch it run...?
 
J

Juan T. Llibre

re:
!> ...so that an individual can view/use it from their client machine.

!> No.

The standard output (stdout) could be captured and displayed, couldn't it ?
 
M

Mark Rae [MVP]

re:
!> ...so that an individual can view/use it from their client machine.

!> No.

The standard output (stdout) could be captured and displayed, couldn't it
?

Oh sure, but I got the impression that the OP needs to have user interaction
with the DOS app...

Obviously if that's not the case, then this will present no problem at
all...
 
W

wmotter

That's what I thought...


Yes.

...so that an individual can view/use it from their client machine.

No.


It's nothing to do with security - it's simply that ASP.NET is running on
the server, and that's where any processes which ASP.NET initiates will
run...


That won't make any difference.


Irrelevant...

What does this DOS app do? Why does someone need to watch it run...?

It is not so much they have to watch it run. It is the old norton
commander application that our Data Processing department has used for
over a decade and the decision was that there was no need to upgrade
since it does everything the DP folks need and there are several
legacy apps integrated with it. The idea is the DP folks select a
work order when it comes time in the process flow for them them to
take action. Once the work order is selected they can then bring up
NC to get a list of files that are part of the work order and go to
town. This was working before with HTML only web site. Now that I
have had this conversation I think I made a stupid mistake. The DOS
app needs to be local on each machine that is going to use it (not a
problem since it is an interanl app). If so, humbled again. But the
question remains can a web app start a local copy of a DOS app
with .net? Am I off base on this?

Mark thanks for the response and especially the time. I did not have
anyone here I could bounce this off of and make me think in other
directions. Got tunnel vision.
 
J

Juan T. Llibre

re:
!> Oh sure, but I got the impression that the OP
!> needs to have user interaction with the DOS app...

That won't happen, as you well know...

;-)
 
M

Mark Rae [MVP]

The DOS app needs to be local on each machine that is going to use it
(not a problem since it is an interanl app).
Ah...

But the question remains can a web app start a local copy of a DOS app
with .net?

Absolutely not natively, for fairly obvious security reasons - "format c:"
is a useful utility, but you wouldn't want a website to be able to execute
it on client machines... :)

Your only hope with this is to write an ActiveX control (or Java applet if
you're not using IE) which will kick the DOS app off, but you'll need to
ramp down your browser security for this...
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top