Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > cmd.exe should run in impersonate account.

Reply
Thread Tools

cmd.exe should run in impersonate account.

 
 
Arulraj Joseph
Guest
Posts: n/a
 
      11-29-2003
Hi All,

I am starting a new process from asp.net(cmd.exe). See the following
code,

System.Security.Principal.WindowsImpersonationCont ext
impersonationContext =
((System.Security.Principal.WindowsIdentity)User.I dentity).Impersonate();

ProcessStartInfo oProcessStartInfo = new ProcessStartInfo();
oProcessStartInfo.FileName = "c:\getUser.exe > c:\a.out";
oProcessStartInfo.Arguments = szCommand;
oProcessStartInfo.RedirectStandardOutput = true;
oProcessStartInfo.CreateNoWindow = false;
oProcessStartInfo.UseShellExecute = false;
Process oProcess = new Process();
oProcess.StartInfo = oProcessStartInfo;
oProcess.Start();
oProcess.WaitForExit();

impersonationContext.Undo();

When the process starts, it is running in the aspnet account and not
the impersonate account. How will I run in the impersonate
account(similar
to launching user concept to dcomcnfg.exe).

Note : getuser.exe will output a user name to c:\a.out the code for
getuser.exe is

using System;

namespace getuser
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Console.WriteLine(System.Security.Principal.Window sIdentity.GetCurrent().Name);
}
}
}

Help appreciated.

Thanks,
Arulraj Joseph.
 
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
DirectoryEntry Impersonate or WindowsIdentity Impersonate? Bill Belliveau ASP .Net Security 3 01-31-2004 04:19 AM
Impersonate asp application to run like IIS basic authentication. Erez Shor ASP .Net 5 01-24-2004 12:33 PM
network (drive) access/impersonate identity problem Peter O'Reilly ASP .Net 2 11-03-2003 09:14 PM
identity impersonate for web applications William F. Robertson, Jr. ASP .Net 0 08-29-2003 05:34 PM
<identity impersonate> and NETWORK ACCESS DB-HELP Christian Binder ASP .Net 0 07-25-2003 07:25 AM



Advertisments