如题,页面第一次下载excel时候提示下载内容有风险,要确认后才能再次下载,能在程序里去掉这个确认提示吗?问了不止一遍了,至今没有得到答案!!!!!

解决方案 »

  1.   

    你直接下载一个服务器上存在的excel文件会有安全提示吗?如果有,那就没有办法了.
    如果没有,你检查一下你导出时 Content-Type的设置.
      

  2.   

    不是说服务器配置出错了,直接下载一个excel文件时,是看你的客户端浏览器对excel这种类型的文件是不是有安全提示,如果没有,
    那是你导出时的类型不对,导致提示,
      

  3.   

    我试过了,直接下载没有提示,怎么修改类型呢?
     Response.ContentType = "application/x-excel";
                Response.Redirect(filePath + "#" + DateTime.Now.ToString(), true);
    这样写行不行啊?
      

  4.   

    Content type试试  application/vnd.ms-excel
      

  5.   

    试过的方法:
     string pathUrl = Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.IndexOf("SaleManager/"));
                pathUrl += @"QuotationFile/" + gFileName;
                Session["curQuotationFile"] = pathUrl;
              //  Response.Redirect(pathUrl);
                //Response.Redirect("~/tranxls.aspx");
                //#region 之前的做法
               iframeTrans.Attributes["src"] = "../tranxls.aspx?t=" + DateTime.Now.Ticks.ToString();            //Response.ContentType = "application/vnd.ms-excel";
                //Response.AddHeader("Content-Disposition", "attachment;filename=" + gFileName);
                //Response.Redirect(pathUrl);            //Response.ContentType = "application/vnd.ms-excel";//"application/x-excel";
                //Response.Redirect(filePath + "#" + DateTime.Now.ToString(), true);
                //#endregion