For Programmers: Free Programming Magazines  


Home > Archive > Software Engineering > May 2006 > .NET: shelling a process kills session variables at next postback









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author .NET: shelling a process kills session variables at next postback
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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com