在Response.AddHeader方法上设置错误消息?

时间:2011-07-22 12:31:17

标签: asp.net database

我有一个功能:

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中没有实际的文件数据。在这个函数中,我尝试显示消息。它不起作用。

0 个答案:

没有答案