Process.Start() fails

Discussion in 'ASP .Net Security' started by Mervin Williams, Jan 27, 2010.

  1. I am trying to call a console application from within my ASP.NET application. The strErrors variable returns:

    "System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: Access is denied.
    ---> System.Security.SecurityException: Access is denied."
    Here is the code. The executable referred to by the PAMWriterPath points to a custom executable and resides on the same pc. I've given the ASP.NET webapp's Anonymous user account full access to the conole application's directory. Any help would be greatly appreciated.

    Process p = new Process();

    p.StartInfo.FileName = ConfigurationSettings.AppSettings["PAMWriterPath"];
    p.StartInfo.Arguments = "PostSub";
    p.StartInfo.UseShellExecute = false;
    p.StartInfo.CreateNoWindow = true;

    p.StartInfo.RedirectStandardInput = true;
    p.StartInfo.RedirectStandardOutput = true;
    p.StartInfo.RedirectStandardError = true;
    bool started = p.Start();

    StreamWriter sIn = p.StandardInput;
    sIn.AutoFlush = true;
    StreamReader sOut = p.StandardOutput;
    StreamReader sErr = p.StandardError;

    p.WaitForExit();
    sIn.Close();

    string strErrors = sErr.ReadToEnd();
    sErr.Close();

    if (strErrors.Length > 0)
    bret = false;

    sOut.Close();
    p.Close();
    Thanks in advance,

    Mervin Williams
     
    Mervin Williams, Jan 27, 2010
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Saunders
    Replies:
    1
    Views:
    847
    John Saunders
    Nov 18, 2003
  2. Lucas Tam
    Replies:
    0
    Views:
    652
    Lucas Tam
    Jun 17, 2005
  3. William Brogden
    Replies:
    3
    Views:
    2,166
  4. Jakir
    Replies:
    4
    Views:
    3,456
    Jakir
    Sep 1, 2004
  5. jpock76
    Replies:
    0
    Views:
    772
    jpock76
    Aug 23, 2010
  6. Mervin Williams

    Process.Start() fails

    Mervin Williams, Jan 27, 2010, in forum: ASP .Net Security
    Replies:
    0
    Views:
    941
    Mervin Williams
    Jan 27, 2010
  7. Replies:
    2
    Views:
    483
    Grant Wagner
    Dec 23, 2004
  8. dayo
    Replies:
    11
    Views:
    551
    Ilya Zakharevich
    Dec 16, 2005
Loading...