command line

B

BW

How in Asp.net do you run a command line program.

ex. I have a form that allows users to upload files to a directory on the
webserver. If they upload a zip file I want to automatically extract the
files from it. I am very new to ASP programming.



Thanks
BW
 
M

Mark Fitzpatrick

Running a command-line is not something you would really want to do. Your
web host probably won't let you either. To use the command-line you would
need to grant permissions to the ASP.Net engine to do way more than the
asp.net user account should, which is most definitely a no no. Not to
mention most of the tasks you would perform were not designed for being run
from a web-application

Now, since you mentioned a zip file and needing to extract the files, first
thing that you should ask is "where could I find this functionality". If you
go by this approach you can begin to look for ASP.Net capable components
that will perform your task from within ASP.Net. You're in luck though, this
is a fairly easy task. There's an excellent open-source library called
sharpzip that could very well do what you need. Check them out at:
http://www.icsharpcode.net/OpenSource/SharpZipLib/

When looking for components don't forget to look at the component section of
www.asp.net (under resources), www.411asp.net, and of course
www.sourceforge.net
 
R

Rad [Visual C# MVP]

How in Asp.net do you run a command line program.

ex. I have a form that allows users to upload files to a directory on the
webserver. If they upload a zip file I want to automatically extract the
files from it. I am very new to ASP programming.

Thanks
BW

You have a couple of options
1) You can use Process.Start to invoke a process to run a command line
utility, which you can then pass the zip file name to unzip your files e.g
2) You can write a small bit of code using the excellent SharpZipLib to do
this as well

#1 is the simpler option but may be problematic with hosted environments,
especially windows hosted environments, because by default windows does not
have a command line unzip utility
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top