Alex Rivera | Logout

Why do I get "Cannot redirect after HTTP headers have been sent" when I call Response.Redirect()?

Asked 2008-10-01T20:22:48.533
94

When I call Response.Redirect(someUrl) I get the following HttpException:

Cannot redirect after HTTP headers have been sent.

Why do I get this? And how can I fix this issue?

Edit
Report

1 Answer

0

The redirect function probably works by using the 'refresh' http header (and maybe using a 30X code as well). Once the headers have been sent to the client, there is not way for the server to append that redirect command, its too late.

answered 2009-05-01T09:07:35.867

Your Answer