似乎这个空间已经不提供备份功能了 (更正,找到不能备份的原因了,空间使用较多,如果加上备份文件要超过10M,所以就不给备份了),我尝试了多次都没有成功。如果你也需要备份自己的目录,可以尝试下面这段代码:
using
System;
using
System.Data;
using
System.Configuration;
using
System.Collections;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
using
ICSharpCode.SharpZipLib.Zip;
using
System.IO;
public
partial
class
packfolder : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

MemoryStream ms = new MemoryStream();
byte[] buffer;
string path = MapPath("");
string[] files = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories);
using (ZipOutputStream s = new ZipOutputStream(ms))
{
s.SetLevel(9); // 0-9, 9 being the highest compression
foreach (string file in files)
{
ZipEntry entry = new ZipEntry(file.Substring(path.Length+1));
entry.DateTime = DateTime.Now;
s.PutNextEntry(entry);
buffer=File.ReadAllBytes(file);
s.Write(buffer, 0, buffer.Length);
}
s.Finish();
s.Close();
}
buffer = ms.ToArray();
Response.ContentType = "application/zip";
Response.AddHeader("Content-disposition", "attachment; filename= *.zip");
Response.OutputStream.Write(buffer, 0, buffer.Length);
Response.End();
}
}
这段代码引用了 SharpZipLib。
如果你是个懒人,你也可以直接下载这个压缩包上传到你的服务器。
http://files.cnblogs.com/hardrock/packfolder.zip
下面就是我今天登陆后看到的页面提示信息。
AspSpider Free Hosting Termination Notice
It is with deep regret that we inform you that starting May 1, 2008, AspSpider.net will stop offering its free ASP.NET web hosting services. After May 1, 2008, your web sites will remain online for 30 days so that you have the opportunity to download your web site files and seek alternative hosting options. On June 1, 2008, all of our servers will be wiped clean and all web site files will be removed.
AspSpider宣布自2008年5月1日起停止提供免费ASP.NET托管服务,用户网站将在5月1日至6月1日期间保持在线以便下载网站文件并寻找替代方案。6月1日后所有服务器将被清空。
766

被折叠的 条评论
为什么被折叠?



