Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Running process under another user account

Running process under another user account

Scheduled Pinned Locked Moved C#
csharphelpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Paddy Boyd
    wrote on last edited by
    #1

    Hi, I'm trying to run another app from my C# code, under the context of another user. I've been round the web and got the following code from MSDN:

    ProcessStartInfo psi = new ProcessStartInfo(@"C:\Windows\Explorer.exe");//args[0]);
    psi.UseShellExecute = false;

    psi.Domain = userParts[0];
    psi.UserName = userParts[1];
    psi.Password = password;

    Process.Start(psi);

    Which i believe is fine - username and pwd are set correctly and are for a user that i can use to login to our domain. However, i keep getting an error that i have 'unknown username or bad password' - I am connecting from home at the minute over our VPN connection, and i'm wondering if that maybe has something to do with it... Wondering if anybody has seen something similar?

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups