Running a batch file from an ASP.Net page.

U

UJ

I know I know - I've already posted this in the DOTNET.general area but my
problem seems to be specific to asp.net so I'll recap here......

I (after much work) got to the point where I have a batch file that will do
some commands for me. I can run it from a DOS box, double click on it from
Window's Explorer and can run it from a VB.Net console app. The code for the
console app is here:

Dim p As System.Diagnostics.Process = New System.Diagnostics.Process
Try
p.StartInfo.RedirectStandardOutput = False
p.StartInfo.RedirectStandardError = False
p.StartInfo.UseShellExecute = True
p.StartInfo.FileName =
"C:\MarlinApplication\Contents\Items\792\LeftPanel.bat"
p.Start()
p.WaitForExit()
Catch ex As Exception
Dim lstemp As String
lstemp = ex.Message
Dim t As String
t = lstemp
End Try

The batch file runs some stuff and creates an output file.

This code works just ducky. When I put the exact same code in ASP.Net I get
nothing. No errors, no output file, nothings. Looks like it's not even
running (the WaitForExit returns to quickly.....).

Anybody got any thoughts?

TIA - Jeff
 
L

Lenard Gunda

Hi,

ASP.NET applications run under the ASPNET account. Maybe that account does
not have enough rights (probably does not by default) to run your file? Or
maybe the .BAT file is run, but what is inside, that cannot run (because
your .BAT is ran with ASPNET account, so are what is inside it).


-Lenard
 

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

Top