首页 > 解决方案 > 在mvc中下载excel response.end()后有没有办法使用redirecttoaction()函数?

问题描述

在mvc中下载excel response.end()后有没有办法使用redirect to action()函数???我从很久以前就得到了这个问题,并正在寻找一个正确而好的答案??如果答案是否定的,请为此建议任何其他技术。

谢谢

标签: model-view-controller

解决方案


tnq 为您提供支持。参考以下链接:

https://support.microsoft.com/en-us/help/312629/prb-threadabortexception-occurs-if-you-use-response-end-response-redir

我已经尝试过了。但是如果我们在 response.end() 之后使用 response.redirect,它会在发送 HTTP 标头后给出无法重定向。错误。如果我们在 response.end() 之前添加它只会重定向但之后不会下载这样的 excel 文件。

第二个解决方案:请告诉我们可以在下载文件时添加两个标题?我已经在使用 Response.AddHeader("content-disposition", "attachment;filename=QuarterlyReport.csv")

请调查一下。

谢谢


推荐阅读