string fileURL = this.Server.MapPath("你要下載的文件路徑")
;//文件路徑,可用相對路徑FileInfo fileInfo = new FileInfo(fileURL)
;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(fileURL);