| MirkoGeest 2006-05-29, 8:07 am |
| I'm using Visual Basic with Web Forms on .NET 2003 and I'm experiencing a very weird problem:
When the user presses a button, the web application starts a shell process to decompress a *.gz file with gzip.exe. All ok for now, I get some data and send formatted data to the client browser.
When the client then does any ather action which is sent to the server (postback), all session variables have disappeared!!
If you know a way to avoid loosing the session variables, or another way to decompress a *.gz file without shelling a command line application, please answer!!
I attach the shell code here:
Private Sub ShellWithRedirect(ByVal app As String, ByVal args As String, ByVal workingDirectory As String)
Dim ShellProcess As New System.Diagnostics.Process
Try
ShellProcess.StartInfo.FileName = app
ShellProcess.StartInfo.Arguments = args
ShellProcess.StartInfo.UseShellExecute = False
ShellProcess.StartInfo.CreateNoWindow = True
ShellProcess.StartInfo.RedirectStandardError = True
ShellProcess.StartInfo.RedirectStandardOutput = True
ShellProcess.StartInfo.WorkingDirectory = workingDirectory
ShellProcess.Start() 'If I comment this line, Session variables are maintained. If not commented, then I loose them all.
ShellProcess.WaitForExit(5000)
Catch ex As Exception
Console.Write(ShellProcess.StandardOutput.ReadToEnd.ToString)
Console.Write(ShellProcess.StandardError.ReadToEnd.ToString)
Finally
ShellProcess.Dispose()
End Try
End Sub |