-
Intranet design flaw??
Hello all...
I've written here over the past week about problems running apps from an aspx page. I've yet to get a concrete response on how to fix my problem, so I just want to detail the design of this intranet page so that maybe someone can help me get this working.
In my company's intranet, we have a section for web tools, which actually just makes mundane tasks more convenient through the use of ASP.NET. We have some Perl scripts that were written for Combustion to convert files from one framerate to another. It works in linux environments since perl is native there, but our entire studio is Win 2K. So, my idea was to write an ASPX page where users supply the input file and output filename, and upon submission the page would execute the script for them. I wanted it to work much like a postback, because there's no real need for redirection. ActivePerl is installed on the web server, so the perl command is in the path on that system. The files which will be converted will live on network drives that are mapped on the server, and are consistent throughout the studio.
When I run the command to convert the files on the server using Run, the script executes beautifully. However, I've used 3-4 different methods of executing the same exact function with no success. In every attempt, the input/output files were contained on a network mapped drive on the server. The page language is C#.
Attempt 1: Tried using System.Diagnostics.Process to create a process on the server, add the vital ProcessStartInfo to it and starting it. I received an error that the input file could not be opened.
Attempt 2: Used System.Diagnostics.Process with UseShellExecute = false and used StreamReader/Writers for the standard input, output and error, and used "cmd" as the executable app, and "perl scriptname fileForConversion > convertedFile" as the "arguments" for cmd. Still got an error with the input file.
Attempt 3: Tried using AspExec library from www.serverobjects.com. However, all of the examples are in VBscript, and I didn't know how to define the variable or Namespace that AspExec.Execute would be, so this method never really developed at all.
Attempt 4: I converted the perl script to an ASP page with the page language set to PerlScript. I called this page with Server.Execute("convertFPS.asp");, but I got an error stating that the child process couldn't run.
So how should I make this tool? If I need to change permissions, can someone walk me though it? It's an Intranet site, but I still want to keep as much security in the site as possible. However, I have to get this tool working, so I'm at my wit's end on this. Thanks for any help you guys can offer!!
-
1) I set & use the following properties when using the System.Diagnostics.Process object:
.RedirectStandardOutput = True
.CreateNoWindow = True
.UseShellExecute = False
Go onto the servers which contain the folders which you want to read from/write to. Right click these folders in turn & goto properties > security.
2) I'm not great on windows security so you might want to check up these accounts, but from playing in the past, you might want to test your script by giving rights to one/many of these domain & local accounts:
ISR_MACHINENAME
IWAM_MACHINENAME
AuthenticatedUsers
It may be worth you adding the everyone user group just as an initial test to see if this is a folder permissions problem to begin with too.
3) Also, you might want to set a breakpoint before the process.execute line runs & just do a debug.write to see what you're actually passing in as the process executable & the command line variables, then using this in the windows run command to test in the perl script - you may need to be enclosing a path with spaces in double quotes or need to specify the full path to the perl execuable, something stupid like this.
Hope this is of some help!
-
Tried adding the IUSR and IWAM accounts to the mapped network drives, didn't seem to work. The Everyone group already had permissions, and Authenticated Users didn't change anything either. The site is set up to Impersonate an account with administrator access, so I was certain this should work.
So what is happening is that I have redirected input, output and errors to StreamReader/Writers of the Process variable. I set the FileName to "cmd.exe", and then AutoFlush the command-line input StreamReader (sr). I feed sr the string "perl X:\\scripts\\30to25_v0.5 Z:\\EDLs\\input.edl", which is the command to run the script on an input file, and the output would be printed to standard output. However, nothing is printed to standard output, and I get a string in standard error that says the Input File could not be opened. This is an error located inside the perl script, on the line:
Code:
open (EDL, $filename) || die("Input File could not be opened.")
So I know it's running the script, but it just can't open the file. I don't know what else to do to get it to work, and I'd need some instruction on changing permissions so that I don't screw up the security of the Intranet... so I'm hoping there will be more ideas and suggestions here... thanks for the help so far!