Problem with process..

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • john20
    New Member
    • Jul 2008
    • 37

    Problem with process..

    Hi All,

    I am using process class to do some processing with the files and close the process.

    it works fine but the problem is it is emptying all the session value which i am assiging before running the process.

    Below is the Code:

    Code:
    Dim myProcess As Process = New Process()
                    Dim sArguments As String = sProductID & " " & Chr(34) & sLicenseFile & Chr(34) & " " & Chr(34) & sApplicationPath & "metaconfig.txt" & Chr(34)
                    Dim sFileName As String = Chr(34) & sApplicationPath & "license.exe" & Chr(34)
    
                    
                    myProcess.StartInfo.FileName = sFileName
                    myProcess.StartInfo.Arguments = sArguments
                    myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
                    myProcess.StartInfo.CreateNoWindow = True
                    myProcess.Start()
                    myProcess.WaitForExit(1000)
    
                    If Not myProcess.HasExited Then
                        myProcess.Kill()
                    End If
    
                    myProcess.Close()
                    myProcess = Nothing
    
                    System.Threading.Thread.Sleep(1000)
    how to solve this problem. can u tell me any solution.

    Thanks

    -John
  • joedeene
    Contributor
    • Jul 2008
    • 579

    #2
    You are calling the .WaitForExit() method before you try to close it, it seems. Well, the .WaitForExit() method is to be called after the .Kill() method

    Quote from MSDN
    Note:
    The Kill method executes asynchronously. After calling the Kill method, call the WaitForExit method to wait for the process to exit, or check the HasExited property to determine if the process has exited.
    So, just try the Process.Kill() first, and then the Process.WaitFor Exit(). without the .close() or anything and just try that. Also, please use CODE[#] tags, when posting with more than a line of code. Please take the time to read the Posting Guidelines. And let me know if that works for you...

    joedeene

    Comment

    • john20
      New Member
      • Jul 2008
      • 37

      #3
      Originally posted by joedeene
      You are calling the .WaitForExit() method before you try to close it, it seems. Well, the .WaitForExit() method is to be called after the .Kill() method

      Quote from MSDN
      Note:


      So, just try the Process.Kill() first, and then the Process.WaitFor Exit(). without the .close() or anything and just try that. Also, please use CODE[#] tags, when posting with more than a line of code. Please take the time to read the Posting Guidelines. And let me know if that works for you...

      joedeene
      Hi Joedeene,

      Thanks for your reply.
      Tried above solution but didn't help.
      Is there any other way to solve this problem.

      Thanks
      -john
      Last edited by Plater; Oct 14 '08, 01:08 PM. Reason: removed extra blank lines

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        What session values are you refering to? I don't see any in the code you posted?
        What is the actual problem?

        Comment

        • john20
          New Member
          • Jul 2008
          • 37

          #5
          Originally posted by Plater
          What session values are you refering to? I don't see any in the code you posted?
          What is the actual problem?
          Thanks for your reply.

          In the page load i am calling above function and assiging value to session variable.
          like Session("Valid" ) = "True"

          after loading this page i am redirecting the page to another page and there i am checking the session value but it is showing empty value.

          Thanks again

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            That is normally a browser issue, or an issue of code flow not being what you think it is.

            The webpages are on the same application though yes?

            Comment

            • john20
              New Member
              • Jul 2008
              • 37

              #7
              Originally posted by Plater
              That is normally a browser issue, or an issue of code flow not being what you think it is.

              The webpages are on the same application though yes?

              Yes pages are on the same application.

              Comment

              • Plater
                Recognized Expert Expert
                • Apr 2007
                • 7872

                #8
                What exactly does the relatable code look like?
                I am guessing that your browser is just not sending the session value (security settings rejecting it), but its possible the Session value never gets set in the first place.

                Comment

                Working...