做了个图书网站-----想实现提供下载功能。????怎么办呢
public void FileDownload(string FullFileName)
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
FileInfo DownloadFile = new FileInfo(FullFileName);
context.Response.Clear();
context.Response.ClearHeaders();
context.Response.Buffer = false;
context.Response.ContentType = "application/octet-stream ";
//Response.ContentType = "application/ms-excel ";
context.Response.AppendHeader( "Content-Disposition ", "attachment;filename= " HttpUtility.UrlEncode(DownloadFile.FullName, System.Text.Encoding.UTF8));
context.Response.AppendHeader( "Content-Length ", DownloadFile.Length.ToString());
context.Response.WriteFile(DownloadFile.FullName);
context.Response.Flush();
context.Response.End();
}
http://topic.csdn.net/u/20070910/20/c4b5593a-5842-43de-a665-cd00a3cc9b0a.html
他们设置了哪些标签:
谁收藏了这个网址:
时间:2008-1-11 16:57:57 | 相关网摘
public void FileDownload(string FullFileName)
{
System.Web.HttpContext context = System.Web.HttpContext.Current;
FileInfo DownloadFile = new FileInfo(FullFileName);
context.Response.Clear();
context.Response.ClearHeaders();
context.Response.Buffer = false;
context.Response.ContentType = "application/octet-stream ";
//Response.ContentType = "application/ms-excel ";
context.Response.AppendHeader( "Content-Disposition ", "attachment;filename= " HttpUtility.UrlEncode(DownloadFile.FullName, System.Text.Encoding.UTF8));
context.Response.AppendHeader( "Content-Length ", DownloadFile.Length.ToString());
context.Response.WriteFile(DownloadFile.FullName);
context.Response.Flush();
context.Response.End();
}