我有一个功能:
private void DownloadFileByCounter(byte[] fileBlob, string fileName, string defaultExt){
if (fileBlob == null){
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.Buffer = false;
Response.BufferOutput = false;
Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
Response.AddHeader("Content-Length", "0");
Response.ContentType = "application/octet-stream";
Response.HeaderEncoding = new UTF8Encoding();
Response.Clear();
Response.End();
}
}
当fileBlob = null时,表示DB中没有实际的文件数据。在这个函数中,我尝试显示消息。它不起作用。