By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,053 Members | 922 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,053 IT Pros & Developers. It's quick & easy.

Visual Basic .NET with Web Forms: session variables lost when shelling a process

P: n/a

(Webmaster: sorry, I posted this first at the General Software
Engineering category, but I think this goes here)

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

--
MirkoGeest
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

May 30 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.