t kkk

t kkk

  • NA
  • 2
  • 3.9k

How to run an exe from network location

Dec 12 2011 5:48 PM
I want to launch an exe located in network from an asp.net web page.

when i compile my project and run it locally it works. But when deployed in server, its not able to get to the network location.

like my executable is at \\msdatadomain1\production\conversion.exe

here is what I have

 try
        {
            if (!File.Exists(Tools.ConversionExecutable))
                throw (new System.IO.FileNotFoundException("File Not Found " +
                    Tools.ConversionExecutable));
           
            ProcessStartInfo startInfo = new ProcessStartInfo(Tools.ConversionExecutable);
            startInfo.Arguments = @"-univName " + _context.LegalType +
                                  @" -sourceFolder " + Tools.GetFolderName(_context.Source) +
                                   @" -targetFolder " + Tools.GetFolderName(_context.Target) +
                                   @" -univFile " + _context.Universe +
                                   @" -xslt " + _context.Xslt +
                                   @" -logFile " + _context.Log;
            if (_context.Universe == "")
                startInfo.Arguments = startInfo.Arguments.Replace(" -univFile", "");

            Process process = Process.Start(startInfo);
            process.WaitForExit();

        }

I have also used impersonate option in web.config file.

Thanks in Advance.



Answers (1)