Running a CMD command from ASP.NET page
Running a CMD command from ASP.NET page
Running a CMD command from ASP.NET page
Running a CMD command from ASP.NET page
Running a CMD command from ASP.NET page
Running a CMD command from ASP.NET page Running a CMD command from ASP.NET page Running a CMD command from ASP.NET page Running a CMD command from ASP.NET page Running a CMD command from ASP.NET page Running a CMD command from ASP.NET page Running a CMD command from ASP.NET page Running a CMD command from ASP.NET page
Running a CMD command from ASP.NET page Running a CMD command from ASP.NET page
Running a CMD command from ASP.NET page
Go Back  Xtreme Visual Basic Talk > > > Running a CMD command from ASP.NET page


Reply
 
Thread Tools Display Modes
  #1  
Old 07-06-2006, 07:31 AM
mcdonnc2004's Avatar
mcdonnc2004 mcdonnc2004 is offline
Junior Contributor
 
Join Date: Dec 2003
Location: Liverpool, UK
Posts: 276
Default Running a CMD command from ASP.NET page


Hey all,

I have a Base64 string that I need to run through a Java appet to generate a JPEG. If I open cmd I would type in the following:

Code:
java -cp mxsigviewer.jar com.momote.signatureviewer.SignatureViewerConsole -d . -o test -b64 wz8LDzIhOTBASVBJWkBAMTAgACgSIiIyEiISs8PBqbC5qQA+KQBCJgoKKSKSoqsqMZIAUCkKKwoaGyobKxsqOSk5OiEwAsGhwqCyoTFBIDIjBaPDobKhsKmwqgB5C5KSk6OUkqKiogKkkqMwKis7SipLSjApIrmi0sKyopICIDEpOjk5OxoKC6ChoACFGQoCMDAgMCmgoqKzoZOSIjApKTobOxoqk5KSk5KTo5OzorGxsKCpuaAAlxoKICAgMCApsKKgkqIDIiApKhoKGwoSA5OSlAOUA7Ojs7GgoaHBoACdMiocORorKysrGksrKiqpobGzopMTITAgIxOjk6KyoaIA
And that would produce a JPEG called test.jpg but I cannot get this work from an ASP.NET page. I tried System.Diagnostics.Process.Start on cmd.exe and passed the above as an argument but its seems it doesn't run.

The Base64 string comes to the page as a http parameter (which I have called sig). I'd like to be able to pass cmd something like:

Code:
System.Diagnostics.Process.Start("cmd.exe java -cp mxsigviewer.jar com.momote.signatureviewer.SignatureViewerConsole -d . -o test -b64 " & sig)

But that does not work! Can anyone help me with this?
Reply With Quote
  #2  
Old 07-06-2006, 07:44 AM
wayneph's Avatar
waynephRunning a CMD command from ASP.NET page wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

The ASPNET and Anonymous User accounts are not going to have any permissions outside of IIS and your defined Web Folders. My guess is that you're going to have to give execute permissions on the directory where java is located, permissions where your .jar file is located, and permissions where you'll be writing the file to. Since I'm not familiar with Java behind the scenes, I'm not 100% sure what permissions those are.

Also, you may want to look at started java directly with the command line you specified. You shouldn't need to call cmd.exe first. Just put 'java' in as the process to be started, and the rest of the command as the options. (or arguments, i can't remember of the top of my head what the property is called.)
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #3  
Old 07-06-2006, 03:55 PM
mcdonnc2004's Avatar
mcdonnc2004 mcdonnc2004 is offline
Junior Contributor
 
Join Date: Dec 2003
Location: Liverpool, UK
Posts: 276
Default

I tried putting in the full path to the java.exe executable but I kept getting file not found which made me think I was not getting access. I gave the ASPNET account access to the Java folder but still got the same thing.

One thing I didn't try was giving ASPNET access to the Program Files folder which the Java folder is located in. The .jar file and the .jpg to be written will be going in the root of the website so that should be ok.
Reply With Quote
  #4  
Old 07-07-2006, 07:01 AM
wayneph's Avatar
waynephRunning a CMD command from ASP.NET page wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

then you may need to specify full paths to things directly in the command line. You may also want to specify the WorkingDirectory using the ProcessStartInfo class for starting your process.
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Running a CMD command from ASP.NET page
Running a CMD command from ASP.NET page
Running a CMD command from ASP.NET page Running a CMD command from ASP.NET page
Running a CMD command from ASP.NET page
Running a CMD command from ASP.NET page
Running a CMD command from ASP.NET page Running a CMD command from ASP.NET page Running a CMD command from ASP.NET page Running a CMD command from ASP.NET page Running a CMD command from ASP.NET page Running a CMD command from ASP.NET page Running a CMD command from ASP.NET page
Running a CMD command from ASP.NET page
Running a CMD command from ASP.NET page
 
Running a CMD command from ASP.NET page
Running a CMD command from ASP.NET page
 
-->