string strFilePath = Server.MapPath("~") + "<yourfilepath>";
FileInfo fileInfo = new FileInfo(strFilePath);
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=" + Server.UrlEncode(fileInfo.Name.ToString()));
Response.AddHeader("content-length", fileInfo.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.ContentEncoding = System.Text.Encoding.Default;
Response.WriteFile(strFilePath);
Asp.net文件下载
最新推荐文章于 2024-04-24 18:21:45 发布