2

some one please tell me how to give permissions for iis user to cmd.exe and run commands from serverside code.

i can open cmd and run commands on local host but not on the web page. same for note pad

I have wrote System.Diagnostics.Process.Start("cmd" ) this open up an cmd when i view page in local host.

but not on the web page.....

I have ticked allow to interact with desk top in IIs admin Service and restart the service too.

any guidence will be more appriciate

I am running this on server. on serverside script , I have use processStartInfo, Process to start cmd.exe and send some commands. this work in localy (mean if I view page on localhost) but not in web page application pool identity set to Network service.

So how do I give permission to newtwork service to run cmd.exe and read output ?

Here is my code for executing a cmd and its working in local but else its not.

  private void createCHM()
        {
            //Generate CHM File
            using (Process p = new Process())
            {
                //Open the created hhp project compiled file          
                p.StartInfo = new ProcessStartInfo("cmd", "/k \"\"" + CHMPath + "\"" + " \"" + hhpPath + "\\Contents\\" + random + ".hhp\"\"");
                //the System shell will not be used to control the process instead program will handle the process and required to redirect result
                p.StartInfo.UseShellExecute = false;
                p.StartInfo.ErrorDialog = true;
                p.StartInfo.CreateNoWindow = true; //make the the cmd window not visible : set to true
                p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; //make the cmd work behind the program : set to Hidden
                //redirect all the standard input and output to program
                p.StartInfo.RedirectStandardError = true;
                p.StartInfo.RedirectStandardInput = true;
                p.StartInfo.RedirectStandardOutput = true;
                p.Start();
            }
        }
bRaNdOn
  • 1,060
  • 4
  • 17
  • 37

0 Answers0