Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

C# Process Problem

  • 20-02-2009 2:30pm
    #1
    Registered Users, Registered Users 2 Posts: 161 ✭✭


    Hi guys,

    I created a new Process in my C# program which calls a batch file which in turn runs a jar. This works fine until I want to redirect standard output and whenever I close the process, it kills the bat file but not the underlying jar.

    After reading up I saw you could call the java.exe itself and pass in the jar as a parameter and it would fix my problems. The trouble with this is I get a "Access is denied" error on the line:
    process.Start()
    

    So, after further reading up I, I realised that I could use Impersonation to as the account I was using might not have permissions to execute the file. Firstly, I added the following line to see what was being logged in:
    WindowsIdentity.GetCurrent().Name;
    

    When debugging, it was filled with my windows authentication details, for instance; DOMAIN\\name. When I check the permissions of the the file java.exe my details are down as DOMAIN\name (note only one backslash) so I think that is stopping me from accessing the file.

    Any ideas on how I can fix this or is there an easier way of getting around my original problem?

    All ideas most welcome,
    ViperMAN


Comments

  • Closed Accounts Posts: 2,268 ✭✭✭mountainyman


    ViperMAN wrote: »
    Hi guys,

    I created a new Process in my C# program which calls a batch file which in turn runs a jar. This works fine until I want to redirect standard output and whenever I close the process, it kills the bat file but not the underlying jar.

    After reading up I saw you could call the java.exe itself and pass in the jar as a parameter and it would fix my problems. The trouble with this is I get a "Access is denied" error on the line:
    process.Start()
    

    So, after further reading up I, I realised that I could use Impersonation to as the account I was using might not have permissions to execute the file. Firstly, I added the following line to see what was being logged in:
    WindowsIdentity.GetCurrent().Name;
    

    When debugging, it was filled with my windows authentication details, for instance; DOMAIN\\name. When I check the permissions of the the file java.exe my details are down as DOMAIN\name (note only one backslash) so I think that is stopping me from accessing the file.

    Any ideas on how I can fix this or is there an easier way of getting around my original problem?

    All ideas most welcome,
    ViperMAN

    cast to a string find the character "/" and strip out everything to the left of that.


  • Registered Users, Registered Users 2 Posts: 161 ✭✭ViperMAN


    cast to a string find the character "/" and strip out everything to the left of that.

    Yes I thought of that too. Using the Impersonation LogonUser method but it returned invalid username or password.


Advertisement