Downloading a file over https in IE8, using ASP.NET

I'm trying to make it possible for the user to download an Excel spreadsheet from our site, by having a button that redirect through this: Response.Redirect(string.Format("../excel/ExcelForm.aspx?pathName=&fileNameDisplay={0}&fileNameUnique={1}", "spreadsheet.xls", fileName)); The aspx page just sends back the file through the Response object, like this: Response.ContentType = "application/vnd.ms-excel"; Response.AddHeader("Content-Disposition", "attachment; filename=" + fileNameDisplay); Response.WriteFile(Server.MapPath(pathName + fileNameUnique)); Response.Flush(); Response.End(); Everything works just fine on my machine, but when we're putting it on the server, the https in combination with no-cache settings gives us an error saying "Internet Explorer cannot download [blahblahblah]". The cache settings on the page displaying the excel button: HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache); HttpContext.Current.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1); HttpContext.Current.Response.Expires = 0; HttpContext.Current.Response.AddHeader("Pragma", "no-cache"); HttpContext.Current.Response.AddHeader("cache-control", "private, no-cache, must-revalidate no-store pre-check=0 post-check=0 max-stale=0"); HttpContext.Current.Response.Cache.SetNoServerCaching(); When I remove those lines, everything works just fine. However, I'm not allowed to remove them for other reasons. So I tried adding the following line to the ExcelForm.aspx just before it adds stuff to the header: Response.ClearHeaders(); Which just gives me "Internet Explorer cannot download ExcelForm.aspx from [url]". And that's where I'm stuck. Suggestions?

以上就是Downloading a file over https in IE8, using ASP.NET的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » excel

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏