文件下载后没有发生Response.redirect() [英] Response.redirect() after file download not happening

查看:100
本文介绍了文件下载后没有发生Response.redirect()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个aspx页面,点击一个按钮,生成pdf文件并提供下载。

下载pdf文件后,我做了response.redirect()将用户重定向到另一页但它没有发生。



两个选项中的任何一个都在发生,即下载pdf或重定向页面,但两者都没有发生。

解决方案

使用



 Response.Redirect(url, false 





并检查您是否在任何地方使用Response.End()这个事件,因为你要在最后使用重定向。


try catch中的代码是什么?

如果是,那么尝试将其从try catch中取出。


下载文件&重定向 [ ^ ]

I have an aspx page on which clicking on a button a pdf file is generated and provided for download.
After the pdf file is downloaded i m doing response.redirect() to redirect the user to another page but it is not happening.

Either of the 2 options are happening i.e either pdf is downloaded or page is redirected but both of them are not happening together.

解决方案

Use

Response.Redirect(url, false)



and check that you are not using Response.End() anywhere in this event since you are to use a redirect at the end.


Is that code inside try catch?
If yes then try taking it out of try catch.


Download File & Redirect[^]


这篇关于文件下载后没有发生Response.redirect()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆