使用ExtAspNet系在服务器上的资源的时候会报个脚本错误
请问高手如何解决
错误如下图:
下载代码如下:
String orderId = "c07e7675-a5e7-4552-9abe-d2902d24dd5a";
DataTable model = null;
DataTable dt = business.SelectOrderDetail(orderId, out model);
string name = ExeclHelper.ImportOrder(dt, model);
string filePathName = Server.MapPath("~/File") + "\\" + name;
if (File.Exists(filePathName))
{
FileInfo file = new FileInfo(filePathName);
Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8"); //解决中文乱码
Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(file.Name)); //解决中文文件名乱码
Response.AddHeader("Content-length", file.Length.ToString());
Response.ContentType = "appliction/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
}
//FileStream fs = new FileStream(filePathName, FileMode.Open);
//byte[] bytes = new byte[(int)fs.Length];
//fs.Read(bytes, 0, bytes.Length);
//fs.Close();
//Response.ContentType = "application/octet-stream";
////通知浏览器下载文件而不是打开
//Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(name, System.Text.Encoding.UTF8));
//Response.BinaryWrite(bytes);
//Response.Flush();
//Response.End();
|