posts - 187,  comments - 1159,  trackbacks - 6
不知道博客园有多少朋友在使用AspSpider提供的免费空间,这里想给大家提个醒,AspSpider 将在2008年6月1日删除所有空间,需要备份的朋友请赶紧把自己的空间备份转移,以免造成不必要的损失。
似乎这个空间已经不提供备份功能了(更正,找到不能备份的原因了,空间使用较多,如果加上备份文件要超过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();
       
    }

}
这段代码功能很简单,把制定目录和子目录中的文件按照目录结构压缩到zip文件中供下载,这里我是为了方便,直接默认当前文件所在目录了,这样就可以方便下载整个webroot目录了。

这段代码引用了 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.






posted on 2008-05-19 18:07 RubyPDF 阅读(1768) 评论(3)  编辑 收藏 所属分类: .Net

FeedBack:
2008-05-23 13:43 | shootsoft [未注册用户]
您好,最近做项目碰到一个问题:用户希望把PDF的每一页的页眉页脚和这一页包含的图片抽取出来.因为PDF格式比较特殊,不像Word那样可以通过微软的一些类库直接处理,所以我想问问这个有没有可能实现?我看了一些关于PDF读取的,好像讲到读取图片的很少.
  回复  引用    
2008-05-23 13:44 | shootsoft [未注册用户]
我的电子邮件 shootsoft##china.com.cn多谢谢了~
  回复  引用    
#3楼 [楼主]
2008-05-25 23:29 | RubyPDF      
@shootsoft
iTextSharp没有多少好办法实现你想要的功能。
  回复  引用  查看    

标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
该文被作者在 2008-05-20 07:21 编辑过


相关链接:
 
<2008年5月>
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

与我联系

搜索

 

常用链接

我参与的团队

我的标签

随笔分类(162)

PDF

最新随笔

积分与排名

  • 积分 - 376787
  • 排名 - 60

最新评论

阅读排行榜

评论排行榜