Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Problem of invoking a command line from ASP.NET 2.0?

Reply
Thread Tools

Problem of invoking a command line from ASP.NET 2.0?

 
 
Speech Lover
Guest
Posts: n/a
 
      05-08-2007
Hi,

First of all thanks for any response!
I want to start a command line command from C# 2.0.
Since .net 2.0 provides a way to specify a particular credential in
ProcessStartInfo object to run the command line, I am able to impersonate a
particular user to run this command.

However, no matter how simple the command is, say invoking Notepad.exe, I
always got the following error messages:



System.ComponentModel.Win32Exception was unhandled
Message="The parameter is incorrect"
Source="System"
ErrorCode=-2147467259
NativeErrorCode=87
StackTrace:
at System.Diagnostics.Process.StartWithCreateProcess( ProcessStartInfo
startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at WindowsApplication1.Form1.InvokeDosCommand() in C:\Documents and
Settings\vizhou\My Documents\Visual Studio 2005\Projects\WebSite1
(2)\WindowsApplication1\Form1.cs:line 50
at WindowsApplication1.Form1.button1_Click(Object sender, EventArgs
e) in C:\Documents and Settings\vizhou\My Documents\Visual Studio
2005\Projects\WebSite1 (2)\WindowsApplication1\Form1.cs:line 21
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message&
m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG&
msg)
at
System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at WindowsApplication1.Program.Main() in C:\Documents and
Settings\vizhou\My Documents\Visual Studio 2005\Projects\WebSite1
(2)\WindowsApplication1\Program.cs:line 17
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()


 
Reply With Quote
 
 
 
 
Speech Lover
Guest
Posts: n/a
 
      05-08-2007
Thank you very much for your response.

Your tip is very helpful. I got it working by specifying a complete path to
the application.

In .Net 1.1 the FileName doesn't need to be a complete path as long as
WorkingDirectory is specified.
This is different in .Net 2.0.

I really appreciate your sincere help!


Speech Lover

"MasterGaurav (www.edujini-labs.com)" <(E-Mail Removed)>
wrote in message news:%(E-Mail Removed)...
>> First of all thanks for any response!
>> I want to start a command line command from C# 2.0.
>> Since .net 2.0 provides a way to specify a particular credential in
>> ProcessStartInfo object to run the command line, I am able to impersonate
>> a particular user to run this command.
>>
>> However, no matter how simple the command is, say invoking Notepad.exe, I
>> always got the following error messages:

>
> IMHO, you should not get a permission to start a process in ASP.Net
> And even if you get it, are you using the complete path to Notepath.exe?
>
>
> --
> Happy Hacking,
> Gaurav Vaish | www.mastergaurav.com
> www.edujini-labs.com
> http://eduzine.edujini-labs.com
> -----------------------------------------
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Invoking Java Command from Http Address? John Schutkeker Computer Support 15 05-10-2007 07:27 PM
Invoking a setup / deployment project via the command line? Wade ASP .Net 1 05-26-2006 02:37 PM
Problem invoking Windows copy command using Runtime.getRuntime().exec() Dave Neuendorf Java 5 02-25-2005 05:35 AM
Invoking a command line .exe program Simon Harvey ASP .Net 5 07-29-2004 04:35 PM
Capture external command output line by line on Windows 98, shell problem. Dib Urim Perl Misc 4 12-03-2003 07:57 PM



Advertisments