本文介绍了无法评估表达式,因为代码已优化或本机帧位于调用之上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

int index = Convert.ToInt32(e.CommandArgument);
                   string path = "select FileData,extension,upload_filename,contentType from ImprestExpenseDetails where BillNo='" + index + "'";
                   DataSet ds = new DataSet();
                   ds = objcBLL.GetQueryResult(path, "ImageView");
                   if (ds.Tables["ImageView"].Rows.Count > 0)
                   {
                       Byte[] bytes = (Byte[])ds.Tables["ImageView"].Rows[0]["FileData"];
                       string extension = (string)ds.Tables["ImageView"].Rows[0]["extension"];
                       string filename = (string)ds.Tables["ImageView"].Rows[0]["upload_filename"];
                       string contenttype = (string)ds.Tables["ImageView"].Rows[0]["contentType"];

                       if (extension == ".pdf")
                       {
                           string fpath = Server.MapPath("~/" + filename);
                           Response.Buffer = true;
                           Response.Charset = "";
                           Response.Cache.SetCacheability(HttpCacheability.NoCache);
                           Response.ContentType = contenttype;
                           Response.AddHeader("content-disposition", "attachment;filename=" + filename);
                           Response.BinaryWrite(bytes);
                           Response.Flush();
                           Response.End();
                       }


                       if (extension == ".jpg")
                       {

                       }
                   }





我尝试了什么:



我收到了Response的错误。结束()

i使用HttpContext.Current.ApplicationInstance.CompleteRequest();在使用此错误后,Response.End();

已解决,但未下载文件。

请帮助



What I have tried:

I got the error on Response.End()
i use HttpContext.Current.ApplicationInstance.CompleteRequest(); inplace of Response.End();
after using this error is resolved but file is not downloaded.
Please help

推荐答案


这篇关于无法评估表达式,因为代码已优化或本机帧位于调用之上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 09:18