1

i wanna unzip a file from "Default.aspx" located on "Site1.Com" to "Site2.Com" that my zip file locates on "Site2.Com", can anyone help me ?

A Programmer
  • 625
  • 8
  • 30

1 Answers1

0

Take a look at System.IO.Compression.ZipFile. You'll need .NET 4.5.

Look into Server.MapPath to get the root of the server and you can use the relative location from there to get to your files.

Dustin Kingen
  • 20,677
  • 7
  • 52
  • 92
  • actually i want to unzip a file that is located on other server, i mean i want to unzip "1.zip" on another server using ftp. – A Programmer Mar 06 '13 at 21:13
  • 1
    Well you're gonna need to receive the file and unzip it and then send it back. See [Handling Zip Files Without Third Party Lib in .NET 4.0?](http://stackoverflow.com/questions/5945209/handling-zip-files-without-third-party-lib-in-net-4-0) for Zip support for .NET 4. Or if the files are different virtual directories on the same server you could create a service to do it for you. – Dustin Kingen Mar 06 '13 at 21:14
  • 2
    What @Romoku said - there's no way to tell a server "You should unzip that file in place" unless the server has a process in place to do that. Instead, you'd have to pull it down and send it back. It might be possible to do that entirely in memory, but you're still sending data both ways and using your local CPU to unzip. – Bobson Mar 06 '13 at 21:19
  • no no, look i have a page "www.site.com/Modules.aspx" in this page i have module list with button, by clicking on button "newsModule.zip" will copy to "www.RemoteSite.com/Modules" now i want to unzip it from "www.Site.Com" remotely ! – A Programmer Mar 06 '13 at 21:21
  • If you have the file already on the server at one point then why don't you just unzip it then or persist it to the file system or cache to be unzipped later? – Dustin Kingen Mar 06 '13 at 21:30
  • 1
    What they are saying is that services on www.RemoteSite.com will need to do the unzipping, if the zip file is what is transferred (and in the file system on RemoteSite.com), not Site.com. Otherwise, Site.com will need to send over tehe unzipped contents. – Wonko the Sane Mar 06 '13 at 21:36