
- Feb 16th, 2011, 08:18 AM#1Member
- 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 - Feb 16th, 2011, 07:31 PM#2
- Feb 17th, 2011, 06:14 AM#3Member
- 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 . - Feb 17th, 2011, 06:32 AM#4Hyperactive 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 - Feb 17th, 2011, 07:09 AM#5Member
- 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 ? - Feb 17th, 2011, 07:20 AM#6
- 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 - Feb 28th, 2011, 01:32 AM#8Member
- 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. - 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
0 thoughts to “Refresh page after response.end() download file c#”