Refresh page after response.end() download file c#

Refresh page after response.end() download file c#

refresh page after response.end() download file c#

Here few tricks 0) how to call Response.Redirect after Response.TransmitFile[^] 1) Doing some work after Response.End()[^]. I had a scenario like user would select a file from the list of the files available say page called page1.aspx.. The user needs to download the file. Please refer to the following resources for details: Download a file then either redirect or refresh the page (after response.end)?? · Refresh Web. refresh page after response.end() download file c#
  1. Feb 16th, 2011, 08:18 AM#1
    Member
    Join Date
    Apr 2009
    Posts
    46

    [RESOLVED] Redirect Page after download the file in aspx

    Hi Everyone ,

    I want to Redirect page after download excel file in asp.net .
    download file popup box is open but the page is not redirect .

    I have Redirect Page after write the Response.End() Method .

    Response.End();
    Response.Redirect("abc.aspx");

    but page is not redirect. how could this possible ?
    Please help me.

    Best Regards,
    Dipal Panchal

  2. Feb 16th, 2011, 07:31 PM#2

  3. Feb 17th, 2011, 06:14 AM#3
    Member
    Join Date
    Apr 2009
    Posts
    46

    Re: Redirect Page after download the file in aspx

    Hi ,
    Thanks for you reply .

    I have tried this syntax but in that syntax page is redirect but download popup option is not display.
    Actually I want to export gridview in to excel and after data is exported i want to redirect to another page .Export data coding works perfectly , it can't redirect to another page .

    I hope you understood the problem .

  4. Feb 17th, 2011, 06:32 AM#4
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    India
    Posts
    310

    Re: Redirect Page after download the file in aspx

    First thing, if you are writing response.end then how it will redirect? remove response.end then it will redirect.
    Sagar
    VB6, VB.net,C#,ASP, ASP.net MSSQL, MYSQL

  5. Feb 17th, 2011, 07:09 AM#5
    Member
    Join Date
    Apr 2009
    Posts
    46

    Re: Redirect Page after download the file in aspx

    Originally Posted by sagarpassion
    First thing, if you are writing response.end then how it will redirect? remove response.end then it will redirect.

    Hi ,
    Thanks .
    but if i removed the Response.End() line then Excel is not generated .
    so ,can you please tell me what is the best solution that i got the excel file and page would be redirect ?

  6. Feb 17th, 2011, 07:20 AM#6

  7. Feb 18th, 2011, 02:35 AM#7

    Re: Redirect Page after download the file in aspx

    Hello,

    As soon as you put Response.End, you can't put anything else after that. The Response to the client has ended

    And in this situation, because you are writing a file into the Response, you can't not have the end, as if you put a Response.Redirect in there, the client will never get the file.

    In this situation, I would recommend that you have another page do the work of downloading the file. Let's call it download.aspx. Do all the work of downloading the file in the code behind of this page, then from your main page, use a window.open to open download.aspx, and then close that window once the download has finished.

    Do you see what I mean?

    Gary

  8. Feb 28th, 2011, 01:32 AM#8
    Member
    Join Date
    Apr 2009
    Posts
    46

    Re: Redirect Page after download the file in aspx

    Hi ,
    Thanks for your suggestion.I have tried with this solution and its work perfectly.

    My Problem has been solved.

  9. Mar 1st, 2011, 02:09 AM#9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Forum Rules




Click Here to Expand Forum to Full Width


Источник: https://www.vbforums.com/

Refresh page after response.end() download file c#

0 thoughts to “Refresh page after response.end() download file c#”

Leave a Reply

Your email address will not be published. Required fields are marked *