1
votes

I seem to have a weird issue with the System.Diagnostics.Process.Start method. I have a C# Desktop application using 3.5 SP1 .NET Framework. A user clicks on a label which passes a folder path stored in it's tag as a string to the function. Windows Explorer launches with the correct folder. When this tool is installed on Citrix and is run through a published application, Windows Explorer will still launch but a .NET exception message is also displayed "The System cannot find the file specified".

System.ComponentModel.Win32Exception: The system cannot find the file specified
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(String fileName)

The file path exists as it's just launched it ok and the code works with no errors when logged locally onto the server, it just errors as a published application, my code is below

Label label = (Label)sender;
if (label.ForeColor == Color.Blue) {
   if (System.IO.Directory.Exists(label.Tag.ToString()) == false)
   {
      MessageBox.Show("The specified folder does not exist:" + 
            Environment.NewLine + Environment.NewLine + label.Tag.ToString(), "",
            MessageBoxButtons.OK, MessageBoxIcon.Information);
      return;
   }
   System.Diagnostics.Process.Start(label.Tag.ToString()); 
}

I found this page http://forums.citrix.com/thread.jspa?messageID=1382638 but we don't have IIS on the server anyway.

Can any one help?

Thanks, Rob

1
Do you mean you've done a web deployment so that the user goes to a webpage and clicks install? - djdd87
No this is a Desktop Application which is being published by Citrix as a Published Application. The desktop application has links in it which launch Windows Explorer at various folder locations - rob
These folders are on a network drive. The full address (e.g. domain name etc.) is used to pass into the Start function. The Citrix Server has access to the folder area. Just to confirm Windows Explorer does launch from this function to the correct folder. Once Windows Explorer has launched the exception message appears. - rob

1 Answers

3
votes

Instead of trying to start a process with the folder name, start the process "explorer.exe" and pass the name of the folder as a command line argument. You can find a list of command line arguments accepted by explorer.exe here:

http://support.microsoft.com/kb/314853