Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Jan 10, 2013 @ 00:41
    Anthony Dang
    0

    Executing program on file system

    This is more of a general c# question... 

    A while ago I tried to get execute a program on the file system on click of a button on a page. At the time it was hg that I was trying to execute. I had some random permission issues. I ended up shelving that functionality due to time.

     The issue requirement has popped up again except this time with another file system program.

    The application is impersonating an administration account but I still have this issue. 

    Before I go down the wrong path and spend more time. Does annyone know about what I should specifically look out for when trying to do this? Any info would be helpful. 

     

     

     

     

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Jan 10, 2013 @ 01:05
    Anthony Dang
    0

    I forgot to mention that notepad which is just fine. I'll have a proper stack trace tomorrow. I'm in bed with my nexus 7 right now :-) 

  • Floris Robbemont 57 posts 89 karma points c-trib
    Jan 10, 2013 @ 10:13
    Floris Robbemont
    0

    We did something like that a while ago. Here the (VB.NET) code: www.lucrasoft.nl/downloads/AnthonyImpersonation.rar

    We use the Impersonator class to write to an XML file for the FileZilla FTP service. After that we restart the FileZilla service using a bat file (that's done using the ProcessRunner class).

    It's pretty old code, so I can't tell you if it'll work or not. And I'm pretty sure you need full trust for this :)

    You can convert it using one of the converter tools (Like Telerik or DeveloperFusion).

     

     

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Jan 10, 2013 @ 11:56
    Anthony Dang
    0

    Thanks Floris.

    I'll give it a try.

     

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Jan 10, 2013 @ 13:10
    Anthony Dang
    0

    Just a bit more info about my original error:

     

     

    Lots of exceptions in "v" (v is just for testing... don't mock my variable name!) after running var v = Process.Start(proc);

    Running notepad.exe doesnt have any of these.

     

    ps. I have not tried Floris's impersonation code yet... just trying to figure out why this doesnt work and if impersonation in code is actually required since I already impersonate an administrator set in the web.config.



     

     

  • Grant Thomas 291 posts 324 karma points
    Jan 10, 2013 @ 14:01
    Grant Thomas
    0

    Please provide the Windows error code for the Win32Exception. Win32Exception.ErrorCode and Win32Exception.NativeErrorCode - this can actually be mapped to a description.

Please Sign in or register to post replies

Write your reply to:

Draft