Click here to Skip to main content
15,923,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
after generate report redirecting to new page.(this i have to do )

so, report is generated but gives me error Cannot redirect after HTTP headers have been sent.

here is my code....

C#
view_report(); //gets records  from database.
       try
       {
           Rpt.ExportToHttpResponse(ExportFormatType.Excel, Response, true, "Summary Report");


       }
       catch (Exception ex)
       {
           Console.WriteLine(ex.Message);
           ex = null;
       }
       finally
       {
           Response.Redirect("~/MessagePage.aspx",false);
       }



so i want both
generate report and redirecting to new page.
Posted
Updated 31-May-12 19:35pm
v2

1 solution

Try:
C#
Response.Redirect("~/MessagePage.aspx", false);


Details here: MSDN: HttpResponse.Redirect Method (String, Boolean)[^]
 
Share this answer
 
Comments
Member 8861818 1-Jun-12 1:13am    
try the above solution .report generated but gives error
Cannot redirect after HTTP headers have been sent.
Sandeep Mewara 1-Jun-12 3:20am    
That means you are tampering with Response in your export to XML method. Response already sent there.

In that case, execution of Response again will be difficult.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900