///
<summary>
/// 从服务器下载文件到本机
/// 2006.11.17 by zwb
/// </summary>
/// <param name="FullPath"> 服务器文件路径 </param>
/// <param name="FileName"> 文件名 </param>
public static void DownLoadFile( string FullPath, string FileName)
{
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.ClearContent();
// System.IO.FileInfo DownloadFile = new System.IO.FileInfo(FullPath);
// HttpContext.Current.Response.Clear();
// HttpContext.Current.Response.ClearHeaders();
// HttpContext.Current.Response.Buffer = false;
// HttpContext.Current.Response.ContentType = "application/octet-stream";
// HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename="+HttpUtility.UrlEncode(DownloadFile.FullName, System.Text.Encoding.ASCII));
// HttpContext.Current.Response.AppendHeader("Content-Length", DownloadFile.Length.ToString());
// HttpContext.Current.Response.WriteFile(DownloadFile.FullName);
// HttpContext.Current.Response.Flush();
// HttpContext.Current.Response.End();
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding( " GB2312 " ) ;
HttpContext.Current.Response.ContentType = " application/ms-doc " ;
HttpContext.Current.Response.AppendHeader( " Content-Disposition " , " attachment;filename= " + FileName + "" );
HttpContext.Current.Response.WriteFile(FullPath);
// System.IO.StringWriter tw = new System.IO.StreamWriter();
// System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
// myGrid.RenderControl(hw);
// HttpContext.Current.Response.Write(tw.ToString());
HttpContext.Current.Response.End();
}
/// 从服务器下载文件到本机
/// 2006.11.17 by zwb
/// </summary>
/// <param name="FullPath"> 服务器文件路径 </param>
/// <param name="FileName"> 文件名 </param>
public static void DownLoadFile( string FullPath, string FileName)
{
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.ClearContent();
// System.IO.FileInfo DownloadFile = new System.IO.FileInfo(FullPath);
// HttpContext.Current.Response.Clear();
// HttpContext.Current.Response.ClearHeaders();
// HttpContext.Current.Response.Buffer = false;
// HttpContext.Current.Response.ContentType = "application/octet-stream";
// HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename="+HttpUtility.UrlEncode(DownloadFile.FullName, System.Text.Encoding.ASCII));
// HttpContext.Current.Response.AppendHeader("Content-Length", DownloadFile.Length.ToString());
// HttpContext.Current.Response.WriteFile(DownloadFile.FullName);
// HttpContext.Current.Response.Flush();
// HttpContext.Current.Response.End();
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding( " GB2312 " ) ;
HttpContext.Current.Response.ContentType = " application/ms-doc " ;
HttpContext.Current.Response.AppendHeader( " Content-Disposition " , " attachment;filename= " + FileName + "" );
HttpContext.Current.Response.WriteFile(FullPath);
// System.IO.StringWriter tw = new System.IO.StreamWriter();
// System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
// myGrid.RenderControl(hw);
// HttpContext.Current.Response.Write(tw.ToString());
HttpContext.Current.Response.End();
}