ProcessStart won't start an application within my Programs folder on my web server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dougancil
    Contributor
    • Apr 2010
    • 347

    ProcessStart won't start an application within my Programs folder on my web server

    I'm trying to kick off an application within my Programs folder on my web server with this code:

    Code:
      'This subroutine calls the CSV Parser and executes it'
        Private Sub StartCSVParse(ByVal CSVParse As String)
            Dim process As New Diagnostics.Process
    
            With process
    
                With .StartInfo
    
                    .FileName = "ExcelConverter.exe"
    
                    .Arguments = ""
    
                    .WorkingDirectory = "C:\Program Files\Infrahealth Inc\CSVParser\"
    
                End With
                '
                .Start()
    
            End With
            'This Try is to catch if the application throws any kinds of errors'
            Try
            Catch Exc As Exception
                message2.Text = Exc.Message
            End Try
        End Sub
    and it's not starting the application but I'm also not getting any errors back from the server. I have made sure that the asp.net user has permissions on the folder, and I can run the application on it's own and it runs fine. Does anyone have a suggestion as to why this process start isnt working?

    Thank you,

    Doug
  • PsychoCoder
    Recognized Expert Contributor
    • Jul 2010
    • 465

    #2
    I would put your code inside the Try of your empty Try..Catch block to see if anything is returned from the Catch

    Comment

    • dougancil
      Contributor
      • Apr 2010
      • 347

      #3
      Richard,

      I moved the code ... maybe not as much as I should have:

      Code:
        Private Sub StartCSVParse(ByVal CSVParse As String)
              Dim process As New Diagnostics.Process
      
              With process
      
                  With .StartInfo
      
                      .FileName = "ExcelConverter.exe"
      
                      .Arguments = ""
      
                      .WorkingDirectory = "C:\Program Files\Infrahealth Inc\CSVParser\"
      
                  End With
                  '
                  .Start()
                  'This Try is to catch if the application throws any kinds of errors'
                  Try
                  Catch Exc As Exception
                      message2.Text = Exc.Message
                  End Try
              End With 
          End Sub
      But still nothing. If thats not what you were referencing, please offer me an example.

      Thank you

      Doug

      Comment

      • benwizzle
        New Member
        • May 2010
        • 72

        #4
        put all that stuff inside the try catch...the way you have it setup right now, its not going to catch anything

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #5
          Like this:
          Code:
          Private Sub StartCSVParse(ByVal CSVParse As String)
          
              Try
                  Dim process As New Diagnostics.Process
          
                  With process
          
                      With .StartInfo
          
                          .FileName = "ExcelConverter.exe"
          
                          .Arguments = ""
          
                          .WorkingDirectory = "C:\Program Files\Infrahealth Inc\CSVParser\"
          
                      End With
                      '
                      .Start()
                      'This Try is to catch if the application throws any kinds of errors'
                      
                      Catch Exc As Exception
                          message2.Text = Exc.Message
                      End Try
                  End With 
              End Sub
          Notice how I put the code that could possible throw an exception in the Try part? If that code throws an exception it will be caught...and the code in the Catch section will be executed.

          -Frinny

          Comment

          Working...