dowload.aspx

      HttpContext.Current.Response.Clear();
       HttpContext.Current.Response.AddHeader("Content-Type", "application/octet-stream");
       HttpContext.Current.Response.Charset = "utf-8";
       HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(file.Name, System.Text.Encoding.UTF8));
       HttpContext.Current.Response.AddHeader("Content-Length", file.Length.ToString());
       HttpContext.Current.Response.WriteFile(file.FullName);
       HttpContext.Current.Response.Flush();
       HttpContext.Current.Response.Clear();
       HttpContext.Current.Response.End();
posted @ 2011-05-12 21:01  清新剂  阅读(344)  评论(0编辑  收藏  举报