views:

211

answers:

2

Hi,

I am actually trying to start a process for winzip and zip a folder. This i am doing using the below code in vb.

Dim startInfo As New System.Diagnostics.ProcessStartInfo
Dim pStart As New System.Diagnostics.Process
Dim tempFileName As String
Try
    startInfo = New System.Diagnostics.ProcessStartInfo( _
    "c:\Program Files\WinZip\WINZIP32.EXE")
    startInfo.Arguments = " -a -r ""c:\test.zip"" c:\test"
    startInfo.UseShellExecute = False
    startInfo.WindowStyle = Diagnostics.ProcessWindowStyle.Normal

    pStart.StartInfo = startInfo
    'startInfo.WorkingDirectory = "c:\Program Files\WinZip"
    'startInfo.FileName = "WINZIP32.EXE"
    pStart.Start()
    pStart.WaitForExit()

Catch ex As Exception
    Throw
End Try

This works fine when its put in a button click event of a windows application. But when the same is done in a button click event of a web application i can see the process is started in the task manager of the machine. But its does not zip nor does it close the application nor does it pop up its winzip ui.... But in very few machines this does work fine. In most of the machine i am facing the problem and also able to reproduce the problem consistently...

But a similar thing if i try doing using 7z zip, it does work fine form a web application itself...

Please let me know if there is any solution or workaround for this...

Thanks Vinod T.

A: 

It might be something to do with the user that IIS is running as; try changing the app-pool to run in your identity to see if it works. Of course, winzip is a UI tool - you might do better using a command-line zip utility... pkzip ;-p

Personally, I'd look at using #ZipLib instead - this will allow you to manipulate zip files in managed code.

Marc Gravell
+1  A: 

I believe that the .Net framework has built in zip capabilities. I would try using those first. Your zip program probably isn't running because of permissions on the web server.

Edit

I just checked and there seems to be limited zip support in System.IO.Compression. But according to this discussion, it might not be what you need. That discussion however, mentions an article called "Decompress Zip files with Windows Shell API and C#".

Slapout
is this present in framework 1.14?
Vinodtiru