TwelvestoneBack End

.NET Question


Sign in

  • Waiting for Godot ( 720 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 4.8 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.8 k posts )
    general front end design an...
  • Back End ( 9.6 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
JimmyTheGent
 
2009-11-11

I need to start a process using a different windows user account. I usually do web development and would just use impersonation with that, but I have been working on a Win Forms app and am unsure of the best way.

                    newproc.StartInfo.FileName = "C:\Program Files\Internet Explorer\iexplore.exe"
                    newproc.StartInfo.Domain = "Domain"
                    newproc.StartInfo.UserName = "username"
                    newproc.StartInfo.Password = "password"
                    newproc.Start()

Is there something wrong with the above code? I get a system.invalidOperation exception when running the code.

Thanks in advance for any ideas.

JTG

JimmyTheGent
 
2009-11-12

I have been playing with this today and taken another approach based on some google results.

                'check for impersonation
                If globalVars.ImpersonationUsername IsNot Nothing Then
                    'Secure Password
                    globalVars.secureString(globalVars.ImpersonationPassword)

                    'set process params
                    Process.Start(temp(1), globalVars.ImpersonationUsername, globalVars.ImpersonationSecurePassword, "bds")
                    Exit While
                Else
                    Process.Start(temp(1))
                End If

I get a win32 exception when using a different username and password... should this code work?

JimmyTheGent
 
2009-11-12

Got it working. This code works fine k

Process.Start(temp(1), globalVars.ImpersonationUsername, globalVars.ImpersonationSecurePassword, "bds")

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneBack End

.NET Question