Redirecting to another page after Response.End() has been called in C#

前端 未结 6 2025
一生所求
一生所求 2020-12-11 17:48

I am exporting a gridview to excel, using .Net 4.0 in a web application, on page load and need for the file to be generated and then the page to be redirected to the calling

6条回答
  •  既然无缘
    2020-12-11 18:11

    The problem is Response.End() send the last bits of the page to the client in order to complete the request. In your case, the request contains the file.

    One possible solution is be to open a new page for the download and keep the redirect in the current page.

提交回复
热议问题