impersonation issue when executing a Process.Start("Shutdown",strArgs)

Discussion in 'ASP .Net Security' started by Mixedmingle, Jan 23, 2009.

  1. Mixedmingle

    Mixedmingle Guest

    guys,

    I am trying to execute a shutdown on a remote machine.
    however eventhough I have setup impersonation and according to the
    retrieve username it is using the correct user(Domain\genericuser),
    the remote machine still tells me the user executing the command is
    the domain\Webserver$ account (after giving this account admin
    permissions on the remote computer)

    What am I missing here?

    Code
    --------------------------------------------------------------
    string strArgs = " /m \\\\" + ServerName + " /r";
    WindowsIdentity p = WindowsIdentity.GetCurrent();
    WindowsImpersonationContext impersonationContext = p.Impersonate();
    System.Diagnostics.Process.Start("Shutdown", strArgs);
    impersonationContext.Undo();


    ---------------------------------------------------------------
    web.config

    <authentication mode="Windows"/>
    <identity impersonate="true" userName="Domain\generiguser"
    password="password"/>


    ----------------------------------------------------------------

    please help me out here.

    thanks
    Regards
    Erik
     
    Mixedmingle, Jan 23, 2009
    #1
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.