private void DownloadFiles(string strPath)
    {
        FileInfo fi = new FileInfo(@strPath);
        Response.Clear();
        Response.ClearHeaders();
        Response.Buffer = false;
        Response.ContentType = "application/octet-stream";
        Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fi.FullName, System.Text.Encoding.UTF8));
        Response.AppendHeader("Content-Length", fi.Length.ToString());
        Response.WriteFile(fi.FullName);
        Response.Flush();
        File.Delete(strPath);
        Response.End();
    }
posted on 2008-10-09 11:32  一只鱼先生  阅读(281)  评论(0)    收藏  举报